View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Copy Range with Additional Rows to New Workbook

hi kimberly:

don't have enough info so i'll make a stab at it. i am assuming the g20, and
later g22 is the last row of data on sheet1.

so use these:

dim LastRow as long
LastRow = Worksheets("Sheet1").Cells(Rows.Count, "G").End(xlUp).Row
range("A2:G" & Lastrow).copy

give this a try

--


Gary


"Kim" wrote in message
...
Hi everybody,
My name is Kimberly and here is what I am trying to do. I am trying to write
a macro that will take a range (let's say A2:G20) and copy it to a new
workbook. I know how to write a macro on how to do that, but here is my
situation. Is there a way to have the macro copy the activesheet range of
A2:G20, but if a user inserts a row or rows inbetween A2:G20, that the macro
adjusts itself to pick up the additional rows that are added (ex., if two rows
are added, the the macro copies A2:G22)?


Thanks Again

Kimberly