Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Trouble Naming Range

Having trouble naming a range...

Dim rng as Range
Set Rng.....

I need rng to be the length of my sheet...trying to name it and its
failing on me.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Trouble Naming Range

Hi

Do you mean this(example for the A column)

Sub test()
Dim rng As Range
Set rng = Sheets("sheet1").Range("A1:A" & Sheets(1).Range("A" & Rows.Count).End(xlUp).Row)
MsgBox rng.Address
End Sub



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



"Michael Smith" wrote in message ...
Having trouble naming a range...

Dim rng as Range
Set Rng.....

I need rng to be the length of my sheet...trying to name it and its
failing on me.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Trouble Naming Range

Dim rng as Range, i as Long
' set i to the column you need
i = 3
set rng = Range(cells(1,i),cells(rows.count,i).End(xlup))
rng.Name = "MyName"

msgbox Range("MyName").Address(external:=True)
msgbox Thisworkbook.Names("MyName") _
.RefersToRange.Address(external:=True)
--
Regards,
Tom Ogilvy

"Michael Smith" wrote in message
...
Having trouble naming a range...

Dim rng as Range
Set Rng.....

I need rng to be the length of my sheet...trying to name it and its
failing on me.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Trouble Naming Range


that was it! Thanks mucho


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Naming a range hello Excel Discussion (Misc queries) 3 May 7th 07 07:01 PM
Naming a range Andrew B[_2_] Excel Programming 2 May 31st 04 01:34 AM
VB Code Naming a Range (range changes each time) krazylain Excel Programming 4 May 15th 04 12:41 PM
Naming a range cornishbloke[_5_] Excel Programming 1 December 15th 03 02:28 PM
Naming a Range with VB Justin Excel Programming 2 December 1st 03 09:38 PM


All times are GMT +1. The time now is 03:16 AM.

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

About Us

"It's about Microsoft Excel"