Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Posts
    3

    Unanswered: 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.

  2. #2
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    why not use Vlookup? instead of a complex macro?

  3. #3
    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"

  4. #4
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067

    Re: Help with a Simple Macro

    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

  5. #5
    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.

  6. #6
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •