resize question

  • Thread starter Thread starter Gary Keramidas
  • Start date Start date
G

Gary Keramidas

lastrow = Worksheets("Sheet1").Cells(Rows.Count, "R").End(xlUp).Row
Cells(lastrow, "R").Resize(1, 11).Copy
the copy statement will copy from column r over to column ab

i wanted column r to column g, so i tried
Cells(lastrow, "R").Resize(1, -11).Copy
didn't like the minus

so i used
Cells(lastrow, "R").Offset(0, -11).Resize(1, 12).Copy

why didn't the minus 11 work and is there a better way?

thanks
 
Size doesn't have anything to do with location. You can't say I want a 1
x -11 range. So you have to offset, then resize like you have shown.

or you could do

lastrow = Worksheets("Sheet1").Cells(Rows.Count, "R").End(xlUp).Row
Cells(lastrow, "H").Resize(1, 11).Copy

which would be columns H to R for the given row.
 
thanks tom , used it

--


Gary


Tom Ogilvy said:
Size doesn't have anything to do with location. You can't say I want a 1
x -11 range. So you have to offset, then resize like you have shown.

or you could do

lastrow = Worksheets("Sheet1").Cells(Rows.Count, "R").End(xlUp).Row
Cells(lastrow, "H").Resize(1, 11).Copy

which would be columns H to R for the given row.
 
Back
Top