View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Listing/Selecting/Viewing Range Names

Private Sub SetRangeName()
Dim RowID As Long
Dim rngNum As Long
Dim rngType As String
Dim rngName As String

RowID = ActiveCell.Row
rngType = "INFO"
rngNum = 1

'*** At this point I need to somehow FIND the next available number and
'change the rngNum to it ***

rngNum = rngNum + 1

--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Rob"
wrote in message
I am trying to set names for a range of cells by something like this...

Private Sub SetRangeName()
Dim RowID
Dim rngType, rngNum, rngName

RowID = ActiveCell.Row
rngType = "INFO"
rngNum = "1"

*** At this point I need to somehow FIND the next available number and
change the rngNum to it ***

rngName = rngType & "_" & rngNum

Range("A" & RowID & ":F" & RowID + 9).Select
Selection.Name = rngName

I want to set the names by selecting Cell A7 and then use a CommandButton to
automatically select the cells and apply the name, then I select A17 and do
the same.
How do I find the next available number?
Then I want to create a list of all the range names and apply them to a
selectable drop-down list in Cell A5? And when I select a range name from the
drop-down list all the other cells are hidden or at the very least the
selected range is displayed.
That's alot but I'm hoping that it's able to be done.
Thanks in Advance.
Rob