I have spent all day today to work out why my code is not working. I have got help from other site, but would keen to know why my own code is not working. I am sure the expert would be able to spot it. Although, I have three question on this code, for now I need to find why my code is not working.
This code works
Sub copy_pastedates()
Dim lr As Long, c As Range
lr = Worksheets("EDM WIP").Range("B" & Rows.Count).End(xlUp).Row
For Each c In Worksheets("EDM WIP").Range("H7:H" & lr)
If IsDate(c.Value) Then
Sheets("EDM Work Completed").Cells(Rows.Count, 1).End(xlUp).Offset(1).Resize(, 8) = _
c.Offset(, -6).Resize(, 8).Value
End If
Next
End Sub
My code is not too different from the above, but only copies one row. Please spot the error for me.
Sub copy_pastedates1()
Dim lr As Long, c As Range, Rng As Range, ws2 As Worksheet
On Error Resume Next
lr = Worksheets("EDM WIP").Range("B" & Rows.Count).End(xlUp).Row
For Each c In Worksheets("EDM WIP").Range("H7:H" & lr)
If IsDate(c.Value) Then
c.Offset(, -6).Resize(, 9).Copy
Worksheets("EDM Work Completed").Range("A4:A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
End If
Next c
End Sub
Bookmarks