Thread: range question
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default range question

Try this JT

vlastrow = 20
ActiveWorkbook.Names.Add Name:="Range", RefersToR1C1:="=R2C23:R" & vlastrow & "C24"


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JT" wrote in message ...
I want to create a range on the active sheet in a workbook
and tried the following code but keep getting an error.
Here is the code:

ActiveWorkbook.Names.Add Name:="Range", RefersToR1C1:="=!
R2C23:R(vlastrow)C24"

I assume I have some type of syntax error.

Since the lastrow in the range will be changing each time
the macro is run, I wanted to use a variable to designate
the last row. Can I do this?

Any help with this issue would be great. Thanks