copying with a vba code

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.
 
J

jeff

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
 
N

nowfal

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top