Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Range question | Excel Worksheet Functions | |||
Range question in '97 | Excel Discussion (Misc queries) | |||
Range question | Excel Programming | |||
Range question | Excel Programming | |||
Range.Formula and Range question using Excel Automation | Excel Programming |