![]() |
range question
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 |
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 |
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 |
All times are GMT +1. The time now is 01:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com