Results 1 to 28 of 28

Search Data from Multiple Sheets and copy found data to new workbook

Threaded View

  1. #1
    Registered User
    Join Date
    06-25-2012
    Location
    Lawton, Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    23

    Search Data from Multiple Sheets and copy found data to new workbook

    I would attach the .xls's here but they are both 5.4MB's big (avg of 2.5 million cells). They are the schedules of where my father has worked for the last 3 years at a company. They have included everyone on the schedule (not just him). I need to find his name on each sheet between both workbooks (I'll run the macro two times if I need to. Once for each workbook), copy the whole row, then paste it into a NEW workbook. (Each workbook has 69 slides). Now, I have tried using some VGA scripts I came across but nothing seems to do the trick... Maybe I am just retarded in this area. I'm seriously biting the bullet at this point and nervous that I will not complete on time.

    Some specifics: The column I will be searching in will be the F or G column; The name will be typed out as; Mr. Bobby , Mr Bobby, or MR BOBBY. Umm anything more just ask. I'm probably not be able to sleep tonight unless I complete this anyways, so I'll be here periodically.

    -Timothy X

    I found ONE script that seems to be in the area of what I am looking for ... but I edited the values and it seems to not work. (After it is finished it says 0 rows copied!) I am green behind the ears but not incompetent. God, I hope one of you guys can help me soon.

    Sub customcopy()
    
    Application.ScreenUpdating = False
    Dim lastLine As Long
    Dim findWhat As String
    Dim toCopy As Boolean
    Dim cell As Range
    Dim i As Long
    Dim j As Long
    
    findWhat = CStr(InputBox("Enter the word to search for"))
    lastLine = ActiveSheet.UsedRange.Rows.Count
    
    j = 1
    For i = 1 To lastLine
        For Each cell In Range("G1:H2000").Offset(i - 1, 0)
            If InStr(cell.Text, findWhat) <> 0 Then
                toCopy = True
            End If
        Next
        If toCopy = True Then
            Rows(i).Copy Destination:=Sheets(2).Rows(j)
            j = j + 1
        End If
        toCopy = False
    Next
    
    i = MsgBox(((j - 1) & " row(s) were copied!"), vbOKOnly, "Result")
    
    Application.ScreenUpdating = True
    End Sub
    Attached Files Attached Files
    Last edited by xenith1988; 06-26-2012 at 06:13 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1