Hi Guys
What I am trying to do here is to copy data from a sheet [called Full Bank Statement] that is between 2 dates held in A2 & B2 of the sheet and where the data meets the criteria, copy from columns 1 - 6 into the first empty cells of the sheet [January]
I only want to copy the cells in those columns as I have formulas in the cells from column 7 onwards.
The code I have seems to work until the last row beginning "Sheets" where I get the error:
Run-time error 1004
Application-defined or object-defined error
The Code I created was:
Any help would be gratefully received
Derek
What I am trying to do here is to copy data from a sheet [called Full Bank Statement] that is between 2 dates held in A2 & B2 of the sheet and where the data meets the criteria, copy from columns 1 - 6 into the first empty cells of the sheet [January]
I only want to copy the cells in those columns as I have formulas in the cells from column 7 onwards.
The code I have seems to work until the last row beginning "Sheets" where I get the error:
Run-time error 1004
Application-defined or object-defined error
The Code I created was:
Rich (BB code):
Sub JanuaryData()
Dim lastrow As Long
Dim erow As Long
Dim i As Long
Dim mydate As Date
lastrow = Sheets("Full Bank Statement").Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Full Bank Statement").Range("A3").Select
For i = 4 To lastrow
mydate = Cells(i, 1)
If mydate >= Sheets("Full Bank Statement").Range("A2") And mydate <= Sheets("Full Bank Statement").Range("B2") Then erow = *_ Sheets("January").cellls(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Sheets("Full Bank Statement").Range(Cells(i, 1), Cells(i, 2), Cells(i, 3), Cells(i, 4), Cells(i, 5), Cells(i, 6)).Copy Destination:=Sheets("January").Cells(erow, 1)
Next i
End Sub
Any help would be gratefully received
Derek