Hi! I have a user form and on it I have a Combobox. When I load the userform I would like the Combobox to be populated automatically from a range in the Excel spreadsheet. I have written the following code but does not appear to work..
Private Sub UserForm_Load()
Dim Row1 As Integer
Dim Row2 As Integer
Row1 = Sheets("Database").Range("F5")
'(contents of Sheets("Database").Range("F5") is 1)
Row2 = Sheets("Database").Range("F7")
'(contents of Sheets("Database").Range("F6") is 10)
ThisWorkbook.Names.Add Name:="ComboRange", RefersTo:=ThisWorkbook.ActiveSheet.Range("A" & Row1, "A" & Row2), Visible:=True
ComboBox1.Items.AddRange(ComboRange).Value
End Sub
Any help extremely appreciated!
Best
Bookmarks