Sub Main3()
Dim x As Long
Dim y As Long
Dim LastRow As Long
Dim ws As Worksheet
Dim tempSource As String
Dim tempSourceRow As Long
Dim tempDestRow As Long
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "Main" And ws.Name <> "Master" Then
ws.Activate
If Range("Y1").Value = "serial_access_name" Then
LastRow = Cells(Rows.Count, "Y").End(xlUp).Row
For x = 2 To LastRow
'1) Get the serial_access_name off of the worksheet.
Range("Y" & x).Select
tempSource = ActiveCell.Value
tempSourceRow = ActiveCell.Row
'2) Find the spot in the database page.
Worksheets("Master").Activate
tempDestRow = Cells(Rows.Count, "C").End(xlUp).Row
Cells(1, 3).Select
Cells.Find(What:=tempSource, After:=ActiveCell, LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
'3) Move the data from the worksheet to the database.
'ws.Activate
'Sheets(ws).Range("Y" & tempSourceRow).Select
ws.Activate
Range("Y" & tempSourceRow).Select
'ActiveCell.Offset(0, 1).Activate
Range("Z" & tempSourceRow, "AD" & tempSourceRow).Copy Destination:=Sheets("Master").Range("E" & tempDestRow)
'4) Check next serial_access_name until all are checked.
Next x
End If
End If
Next ws
End Sub
I am taking several sheets of data and moving them into one large sheet which originally I thought might be faster then multiple sheets. However, it seems I might be wrong about that idea.
Bookmarks