Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Range question Jock Excel Worksheet Functions 3 March 19th 08 04:36 PM
Range question in '97 Adam Kroger Excel Discussion (Misc queries) 10 December 12th 05 03:44 AM
Range question mnewnam[_2_] Excel Programming 0 October 28th 04 07:28 PM
Range question strataguru[_21_] Excel Programming 2 October 7th 04 05:35 AM
Range.Formula and Range question using Excel Automation [email protected] Excel Programming 0 September 19th 03 04:53 AM


All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"