Your dimension statement is wrong. Rows are numbers between 1 and 65536, not
ranges.
Dim sh1LastRow As long, sh2LastRow As long
"drinese18" wrote:
> Ok, should the code look somewhat like this?
>
> Sub CopyData()
>
> Dim sh1LastRow As Range, sh2LastRow As Range
>
> sh1LastRow = sheets("Sheet1").range("A" &
> rows.count).end(xlup).row
>
> sh2LastRow = sheets("Sheet2").range("A" &
> rows.count).end(xlup).row
>
> sheets("Sheet1").rows(sh1LastRow).copy _
> destination:=sheets("Sheet2").rows(sh2LastRow + 1)
> End Sub
>
> am I missing anything?
>
> "Joel" wrote:
>
> >
> > sh1LastRow = sheets("Sheet1").range("A" & rows.count).end(xlup).row
> >
> > sh2LastRow = sheets("Sheet2").range("A" & rows.count).end(xlup).row
> >
> > sheets("Sheet1").rows(sh1LastRow).copy _
> > destination:=sheets("Sheet2").rows(sh2LastRow + 1)
> >
> > "drinese18" wrote:
> >
> > > Does anyone know how to copy data from the last line of data in one worksheet
> > > to the last line in the other worksheet. Basically I want to have a macro
> > > that updates a worksheet on a daily basis. It would copy the last line of
> > > data from Sheet 1 onto the last line in Sheet 2. Does anyone know of a way to
> > > do so this or code maybe?
|