Hi,
I am trying to copy certain ROWS from my "DATA" sheet to my "Planning" worksheet with a MACRO, and am having some issues with adding more than 1 Keyword to my search. Right now my Key word is "PFP", and the only way I found to search for another keyword is write out the formula below it in italic, with additional keyword "BBEG". I need to add about 20 keywords and when I type it out this way they all won't fit on the same line, and if I try to move down a line I get an error. Any help in advance on how I should write the code is greatly appreciated, and as a bonus if there is a way to write this so that it searches faster that would be great since I have 3k Rows. Thanks, Matt
Private Sub planner()
a = Worksheets("DATA").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
If (Worksheets("DATA").Cells(i, 5).Value = "PFP") Then
If (Worksheets("DATA").Cells(i, 5).Value = "PFP" Or Worksheets("DATA").Cells(i, 5).Value = "BBEG") Then
Worksheets("DATA").Rows(i).Copy
Worksheets("Planning").Activate
b = Worksheets("Planning").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Planning").Cells(b + 1, 1).Select
ActiveSheet.Paste
Worksheets("DATA").Activate
End If
Next
Application.CutCopyMode = False
ThisWorkbook.Worksheets("DATA").Cells(1, 1).Select
End Sub
I am trying to copy certain ROWS from my "DATA" sheet to my "Planning" worksheet with a MACRO, and am having some issues with adding more than 1 Keyword to my search. Right now my Key word is "PFP", and the only way I found to search for another keyword is write out the formula below it in italic, with additional keyword "BBEG". I need to add about 20 keywords and when I type it out this way they all won't fit on the same line, and if I try to move down a line I get an error. Any help in advance on how I should write the code is greatly appreciated, and as a bonus if there is a way to write this so that it searches faster that would be great since I have 3k Rows. Thanks, Matt
Private Sub planner()
a = Worksheets("DATA").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
If (Worksheets("DATA").Cells(i, 5).Value = "PFP") Then
If (Worksheets("DATA").Cells(i, 5).Value = "PFP" Or Worksheets("DATA").Cells(i, 5).Value = "BBEG") Then
Worksheets("DATA").Rows(i).Copy
Worksheets("Planning").Activate
b = Worksheets("Planning").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Planning").Cells(b + 1, 1).Select
ActiveSheet.Paste
Worksheets("DATA").Activate
End If
Next
Application.CutCopyMode = False
ThisWorkbook.Worksheets("DATA").Cells(1, 1).Select
End Sub