Drop-down-list with Named ranges

C

Chootje

I have searched the net but could not find a solution for the
following:

I have a sheet with about 100 named ranges (multiple columns and rows).
The user has to pick 2 or 3 Named ranges to copy to another file.

Question is how to prompt a list of all Named ranges (preferably from
all sheets) from which the user can pick one, to select the range after
which it can be copied.

An alternative might be that the user is prompted to select a named
range from a drop-down list embedded in the sheet. Problem is I cannot
create this list nor retrieve the proper range from it.

I would appreciate any help or suggestion.
 
F

FunkySquid

Hi there, try this code. You'll need to create a Embeded ComboBox and
call it cmdNamesCombo.

Private Sub Worksheet_Activate()
cmdNamesCombo.Clear

'populate list with named ranges
For intnamescount = 1 To Application.Names.Count
cmdNamesCombo.AddItem (Application.Names(intnamescount).Name)
Next intnamescount
End Sub
Private Sub cmdNamesCombo_Click()
'Goes to selected range name and copies it
Application.Goto Application.Names(cmdNamesCombo.Value).Name
Selection.Copy
End Sub

FunkySquid
 
C

Chootje

Thanks FunkySquid - gonna work on that.
Hi there, try this code. You'll need to create a Embeded ComboBox and
call it cmdNamesCombo.

Private Sub Worksheet_Activate()
cmdNamesCombo.Clear

'populate list with named ranges
For intnamescount = 1 To Application.Names.Count
cmdNamesCombo.AddItem (Application.Names(intnamescount).Name)
Next intnamescount
End Sub
Private Sub cmdNamesCombo_Click()
'Goes to selected range name and copies it
Application.Goto Application.Names(cmdNamesCombo.Value).Name
Selection.Copy
End Sub

FunkySquid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top