Hi VB Experts,
I have the below code working well however what I have in my column F on my main tab is different months, what happens is when column F contains as an example January it would then copy that whole line to another sheet. Column F will contain multiple months for example "January / May / September", what i would like to do is have it move when say the cell contains "January" in the string rather than needing the whole "January / May / September" as sometimes the months are in a different order. It would seem like it currently only moves it to another sheet when it is an exact match rather than containing "January"
Any help would be amazing and thanks in advance.
Sub NewCOPY()
Dim c As Range
Dim Source As Worksheet
Dim Target As Worksheet
Dim Target1 As Worksheet
Set Source = ActiveWorkbook.Worksheets("Companies")
Set Target = ActiveWorkbook.Worksheets("January")
Set Target1 = ActiveWorkbook.Worksheets("February")
For Each c In Source.Range("F1:F" & Source.Cells(Rows.Count, 1).End(xlUp).Row)
If c = "January" Then
c.EntireRow.Copy
Target.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
ElseIf c = "February" Then
c.EntireRow.Copy
Target1.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
End If
Next c
End Sub
Display More