Hi all,
I'm currently using this code to copy data from a Main sheet, based on the "x", "y" and "z" criteria in column Y. I need this code modified to also look at criteria in column N. The options in column N are "OH", "OHD", "RGS", "PTD" and "TBD". In order to be copied Column N must be either "OH", "OHD" or "RGS"
I have 3 different worksheets X, Y and Z that I want each row copied into if it meets both criteria. For example, copy entire row from the Main sheet into worksheet X if column Y is x and column N is any of the three "OH", "OHD or "RGS".
Sub CopyPasteData()
Dim a As Long, x As Long, y As Long
x = Sheets("Main").Cells(Rows.Count, 25).End(xlUp).Row
For a = 2 To x
Sheets("Main").Rows(a).Copy
b = Sheets("Main").Cells(a, 25)
y = Sheets(b).Cells(Rows.Count, 1).End(xlUp).Row
Worksheets(b).Range("A" & y + 1).PasteSpecial
Next a
End Sub
I'm currently using this code to copy data from a Main sheet, based on the "x", "y" and "z" criteria in column Y. I need this code modified to also look at criteria in column N. The options in column N are "OH", "OHD", "RGS", "PTD" and "TBD". In order to be copied Column N must be either "OH", "OHD" or "RGS"
I have 3 different worksheets X, Y and Z that I want each row copied into if it meets both criteria. For example, copy entire row from the Main sheet into worksheet X if column Y is x and column N is any of the three "OH", "OHD or "RGS".
Sub CopyPasteData()
Dim a As Long, x As Long, y As Long
x = Sheets("Main").Cells(Rows.Count, 25).End(xlUp).Row
For a = 2 To x
Sheets("Main").Rows(a).Copy
b = Sheets("Main").Cells(a, 25)
y = Sheets(b).Cells(Rows.Count, 1).End(xlUp).Row
Worksheets(b).Range("A" & y + 1).PasteSpecial
Next a
End Sub