So I've finally been able (after several days of searching) to come up with and modify VBA code that will look for "Y" in column Q of three worksheets and copy the entire row to another worksheet ("!!").
My problem is with z = 3000
I'm trying to reduce the amount of processing it takes to find the data I want and make this code the simplest I can.
I've looked and tried several examples but can not get a last row search, instead of specifying the last row as 3000. Eventually I will have to search more than 3000 rows for the information I want.
Any help is appreciated.
My code:
Sub Test()
Dim i as Integer
Dim j as Integer
Dim cal (1 to 3) As String
cal (1) = "Incident Data"
cal (2) = "Change Data"
cal (3) = "Task Data"
Dim x as Integer
Dim y as Integer
Dim z as Integer
y = 17
z = 3000
j = 2
For x = 1 to 3
For i = 2 to z
If Sheets(cal(x)).Cells(i,y) = "Y" Then
Sheets(cal(x)).Select
Range (Sheets(cal(x)).Cells(i.1), Sheets(cal(x)).Cells(i,17)).Select
Selection.Copy
Application.Goto ActiveWorkbook.Sheets("!!").Cells(j,1)
ActiveSheet.Paste
Else
j = j -1
End If
j = j +1
Next i
Next x
End Sub
Bookmarks