Hi
Part 2 of this isn't working (For i = 2 to last row on) I'm trying to copy and paste relevant cells from each row that is the same as MyCell value which is what I have named each new tab.
Any help welcome thanks.
Part 2 of this isn't working (For i = 2 to last row on) I'm trying to copy and paste relevant cells from each row that is the same as MyCell value which is what I have named each new tab.
VBA Code:
For Each MyCell In MyRange
Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
Sheets(Sheets.Count).Name = MyCell.Value ' renames the new worksheet
Next MyCell
lastrow = ws.Range("a" & Rows.Count).End(xlUp).Row
For i = 2 To lastrow
If ws.Range("d2:d") = MyCell.Value And _
ws.Range("d2:d").Offset(1, 0) <> "Miscellaneous" _
And ws.Range("d2:d").Offset(5, 0) <> "" Then
ws.Range("A" & i & ":F" & i & ",G" & i & ":H" & i).Copy
On Error Resume Next
Sheets(MyCell.Value).Select
ActiveSheet.PasteSpecial Paste:=xlPasteValues
End If
Next i
Any help welcome thanks.