Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 2 of 2

Thread: VBA : Adding Items to ActiveX ComboBox?

  1. #1
    Join Date
    11th March 2004
    Posts
    1
    Does anyone in here know how to add items to a combobox? I have a couple of macros written and ready to go but, I am not to familiar with ActiveX. After I have entered the terms how do I link the macros to run on the selected item?

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    1st February 2003
    Location
    Memphis, TN
    Posts
    891
    Welcome to the forum!

    This is one way to load a combobox if your data is in a range of cells when the form is first activated and also how you can run a procedure based on the ListIndex of the combobox

    Private Sub ComboBox1_Change()
    Select Case ComboBox1.ListIndex
    Case 0
    Run (mymacro)
    Case 1
    Run (yourmacro)
    End Select
    End Sub

    Private Sub UserForm_Activate()
    Dim i As Integer
    For i = 1 To Range(Range("A1"), Range("A1").End(xlDown)).Count
    ComboBox1.AddItem Range("A1").Offset(i - 1, 0).Value

    Next i

    End Sub

    You could also store your items you want to add in an Array and loop through the array to add the items. I am using a form in the VBE to do the above procedures.

    HTH

    Bruce

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Adding Items To A Combobox
    By coolhandphil in forum EXCEL HELP
    Replies: 2
    Last Post: March 2nd, 2007, 17:02
  2. Replies: 3
    Last Post: August 31st, 2006, 17:47
  3. adding column head as items to combobox
    By newvbie in forum EXCEL HELP
    Replies: 12
    Last Post: May 13th, 2006, 21:57
  4. Replies: 3
    Last Post: May 3rd, 2006, 00:15
  5. Adding items to a combobox
    By mysrkvg in forum Excel and/or Powerpoint Help
    Replies: 3
    Last Post: August 10th, 2005, 23:31

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
  •  
porno