If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Help with a Simple Macro

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-30-04, 00:18
JazzyLM JazzyLM is offline
Registered User
 
Join Date: Jan 2004
Posts: 3
Help with a Simple Macro

I'm sure this is a simple macro but I'm a virgin to VB macros.

I have a sheet with names and numbers that change daily. For example, one day, 10 of my staff work. The next day, only 5 of them work and another 5 work. So the names change daily.

I tried to record a macro that searches for a name, copies the number, switches to another workbook, pastes the number, switches back to the original and does another search for a new name.

This works great if all the names were there each day. But when a person doesn't work, the macro chokes because it can't find the name I recorded.

I need a macro that pauses for me to enter the name to search for. Then I can type in the correct info and be on my way.
Reply With Quote
  #2 (permalink)  
Old 01-30-04, 02:59
namliam namliam is offline
Registered User
 
Join Date: Jan 2004
Location: The Netherlands
Posts: 421
why not use Vlookup? instead of a complex macro?
Reply With Quote
  #3 (permalink)  
Old 01-30-04, 11:31
DavidCoutts DavidCoutts is offline
Registered User
 
Join Date: Jan 2004
Location: Aberdeen, Scotland
Posts: 1,067
Re: Help with a Simple Macro

what you need for the VB code if you want to manually enter the names is an inputbox. This will work individually.

try something like this

Dim ReturnValue as String

ReturnValue = Inputbox "Enter The Name?","Enter Name"
Reply With Quote
  #4 (permalink)  
Old 01-30-04, 11:33
DavidCoutts DavidCoutts is offline
Registered User
 
Join Date: Jan 2004
Location: Aberdeen, Scotland
Posts: 1,067
Re: Help with a Simple Macro

Quote:
Originally posted by DavidCoutts
what you need for the VB code if you want to manually enter the names is an inputbox. This will work individually.

try something like this

Dim ReturnValue as String

ReturnValue = Inputbox "Enter The Name?","Enter Name"
sorry i hadnt quite finished

when you search do something like

selection.find(returnvalue).select

this will let you search for the values that you type in

David
Reply With Quote
  #5 (permalink)  
Old 01-31-04, 00:58
JazzyLM JazzyLM is offline
Registered User
 
Join Date: Jan 2004
Posts: 3
Hey ... thanks for the help. I am working on some options but I am still clueless. I may be back.
Reply With Quote
  #6 (permalink)  
Old 02-01-04, 19:48
JazzyLM JazzyLM is offline
Registered User
 
Join Date: Jan 2004
Posts: 3
namliam

I was making it too hard. A VLOOKUP works just PEACHY and I can use a simple macro to propagate my data.

Thank you very much.

And thanks to the rest of you for your suggestions.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On