inkserious
Technical User
- Jul 26, 2006
- 67
I'm trying to populate a ComboBox with a named range. For example, I have a named range called currentMonth. This range contains the name of a month. I have named ranges for all of the months. So if currentMonth contains October, then the ComboBox would be populated with the named range October.
I can hardcode the month, but I can't seem to figure out how to take the string value in the currentMonth named range and convert it to the respective range. Thanks in advance for any help anyone can provide.
I can hardcode the month, but I can't seem to figure out how to take the string value in the currentMonth named range and convert it to the respective range. Thanks in advance for any help anyone can provide.
Code:
Private Sub setMonth()
Dim ws As Worksheet
Dim cDate As Range
Set ws = Worksheets("ranges")
For Each cDate In ws.Range("October")
With Me.cboDate
.AddItem cDate.Value
End With
Next cDate
End Sub