Thread: Insert a Range
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve[_4_] Steve[_4_] is offline
external usenet poster
 
Posts: 184
Default Insert a Range

Hello. I am trying to write code that will do an xlendup on a
worksheet to find the last row, and then offset 9 rows up. After I
have the range, copy the range and insert on the next available line.
I tried some code (below) but couldnt get it to work. Any ideas?
Thanks!

lastrow = ActiveSheet.Cells(Cells.Rows.Count, "D").End(xlUp).Row
lastrange = ActiveSheet.Rows(lastrow.Resize(9, 0))

Rows(lastrange).Copy.
Rows(lastrange).Insert Shift:=xlDown