copying with a vba code

  • Thread starter Thread starter nowfal
  • Start date Start date
N

nowfal

Hi,
I am trying to copy sheet 1 to sheet 2 with daily basis. I mean the
first sheet having 10 colomn and so may raws(raws may vary day to day)
with daily records, at the end of the day i wanted to copy the data to
the sencond sheet which will act as a monthly data, so daily it should
add the next line of the previous day in the sheet 2. Any vba code is
possible for this.
thanks.
nowfal.
 
Hi,

Try this code on a test sheet

jeff

Sub CopyDaily()
Dim lastrow As Long
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row

Range("A2:J" & lastrow).Select
Selection.Copy
Application.CutCopyMode = False
Selection.Cut ' or Copy
Sheets("Sheet2").Select
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
Range(Cells(lastrow + 1, 1), Cells(lastrow + 1, 1)).Select
ActiveSheet.Paste
End Sub
 
yes, jeff, its working, thanks. Still i need your help, in the code
wanted to get back one particular cell to the sheet 1, Or Instead o
cut copy, copy and paste is good. later i will manually delete th
sheet 1 or i will add some string on the code. How to change the cu
copy to copy and paste.
thanks a lot
 
Back
Top