Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: find and copy and paste

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    i have a workbook with sheets for each day of the week. on each sheet the left hand column has a persons name and to the right each column is for different data that i have to take from another sheet.
    i was wondering how to write a macro to search that other sheet for their name and then search for a columns data and paste it in the cell

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Milwaukee, WI
    Posts
    105
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I just did this one the other day. I recommend runing a loop that uses the VLOOKUP function to find the data you need. With the VLOOKUP, you'll need a variable to represent the name. Then lookup the name in some huge range on the other sheet like A1:FF1000, and for the column use a MATCH method. Example below:

    Name Num1 Num2 Num3
    Green 3 4 5
    Smith 1 2 3
    Jackson 3 6 5
    Jones 8 7 6

    Dim Person as String
    Sub LocateLoop()
    Sheets("MasterSheet").Select
    Range("A2").Select
    Do Until NotIsEmpty(ActiveCell)
    Person = ActiveCell.Value
    ActiveCell.Offset(0,1).Formula = "=VLOOKUP(""" & Person & """,[SheetWithData]!A1:FF1000,MATCH(""Num2"",[SheetWithData]!A1:FF1,0),FALSE)"
    ActiveCell.Offset(1,0)
    Loop
    End Loop




Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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