Thread: range question
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default range question

or

ActiveWorkbook.Range("W2:X" & vlastrow).Name = "Range"



--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ron de Bruin" wrote in message
...
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