View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Copying to a flexible range


lastrow=cells(rows.count,"a").end(xlup).row
range("b12").copy range("a"&lastrow)
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"johncpa" wrote in message
...
I want to copy a formula using a macro but the ending part of the range can
change. For example, the user inputs the current age and a retirement age
and the retirement age can change. How do I create a macro that can allow
the range to be flexible, i.e. 15 years, 20 years, etc. I can copy the
formula manually to the ending range but I want to be able to have a macro
perform this automatically. Any help would be appreciated.