Hi, I'm looking for some solution... that help me to copy each row with specific columns 1,5,10 from other sheets to one main based on criteria.
For example from Sheets: Data 1, Data 2 paste all rows one by one to Sheet: Stats starting in cell B10. Criteria if value in Sheets: Data1,Data 2 colum2 = "Home".
I far manage whole row solution.
For example from Sheets: Data 1, Data 2 paste all rows one by one to Sheet: Stats starting in cell B10. Criteria if value in Sheets: Data1,Data 2 colum2 = "Home".
I far manage whole row solution.
VBA Code:
Sub Stat()
Dim Lastrow As String
Dim lastRowRpt As String
Dim job As String
Dim i As Integer
Set tws = ThisWorkbook.Sheets("Stats")
tws.Range("B9") = "STATS:"
job = "Home"
Lastrow = Worksheets("Data1").Range("B" & Rows.Count).End(xlUp).Row
lastRowRpt = tws.Range("A" & Rows.Count).End(xlUp).Row
For i = 3 To Lastrow
If Worksheets("Data1").Range("B" & i).Value = job And Then
Worksheets("Data1").Rows(i).Copy
lastRowRpt = tws.Range("A" & Rows.Count).End(xlUp).Row
tws.Range("A" & lastRowRpt + 1).Select
tws.Paste
End If
Next i
Dim lastRow2 As String
lastRow2 = Worksheets("Data2").Range("B" & Rows.Count).End(xlUp).Row
For i = 3 To lastRow2
If Worksheets("Data2").Range("B" & i).Value = job And Then
Worksheets("Data2").Rows(i).Copy
lastRowRpt = tws.Range("A" & Rows.Count).End(xlUp).Row
tws.Range("A" & lastRowRpt + 1).Select
tws.Paste
End If
Next i
/CODE]