Use Names of Named Ranges in ComboBox

  • Thread starter Thread starter Eric Zest
  • Start date Start date
E

Eric Zest

Hello, i have about 20 different named ranges in a worksheet. Each named
range highlights a different range of cells.

Is there a way to add the names of these named ranges to a combobox i have
in a userform? I'm trying to use the combox in the form to select just the
name of the named range, not the cells they will highlight. Hope i make
sense. Thanks in advance!
 
Hi

You can only list all named ranges in the workbook you have to test if
the named range is in the desired sheet.

Change Sheet1 to the name of the desired sheet.

For Each n In ActiveWorkbook.Names
If n.RefersTo Like "*Sheet1*" Then
Me.ComboBox1.AddItem n.Name
End If
Next

Regards,
Per
 
Back
Top