Results 1 to 7 of 7

Populating comboboxes in a userform

Threaded View

metametrics Populating comboboxes in a... 01-22-2011, 07:27 AM
Andy Pope Re: Populating comboboxes in... 01-22-2011, 07:51 AM
royUK Re: Populating comboboxes in... 01-22-2011, 08:00 AM
metametrics Re: Populating comboboxes in... 01-22-2011, 09:06 AM
metametrics Re: Populating comboboxes in... 01-22-2011, 09:06 AM
metametrics Re: Populating comboboxes in... 01-22-2011, 09:07 AM
royUK Re: Populating comboboxes in... 01-22-2011, 09:34 AM
  1. #1
    Registered User
    Join Date
    01-22-2011
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    Populating comboboxes in a userform

    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
    Last edited by metametrics; 01-23-2011 at 07:26 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1