+ Reply to Thread
Results 1 to 4 of 4

Form Control Combo Box Selection

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Form Control Combo Box Selection

    Hello,
    how do you run a macro according to the selection made in a form control combo box?

    essentially whatever I have selected in the combo box I want filtered in a table, the cell which is the table header i need the filter on is in A10 and called 'Order No' of the 'Prt2Rec' table

    Please help

  2. #2
    Registered User
    Join Date
    08-06-2013
    Location
    Berlin, Germany
    MS-Off Ver
    MS Office 2010
    Posts
    5

    Re: Form Control Combo Box Selection

    Hi,

    You can access the contents of the combo box just like the contents of a normal text box, i.e.

    ComboBoxName.Text
    will give you the content of the combo box.

  3. #3
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: Form Control Combo Box Selection

    Hi Philip,
    I'm not sure I understand? The values are from a range of cells on the sheet, but I would like to filter the table below according to the value selected in the form control combo box. eg 3004
    *the table column I would like to filter according to the value selected in the combo box is in A:10 [Order No]

  4. #4
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: Form Control Combo Box Selection

    ok!! I've worked it out :D

    Silly me didn't know where to look to find the form control name :p (top left, where cell reference is)

    So... after renaming my combo [cmbPO], I created a macro to filter the table on the Order number field for each value in the drop down:

    Sub Records3004()
    ' Records3004 Macro
        Range("GE_Prt2Rec[[#Headers],[Order No]]").Select
        ActiveSheet.ListObjects("GE_Prt2Rec").Range.AutoFilter Field:=1, Criteria1 _
            :="3004"
    End Sub
    and then associated the following code with the combo box:

    Sub RuncmbPO()
        With ThisWorkbook.Sheets("POs").Shapes("cmbPO").ControlFormat
            Select Case .List(.Value)
                Case "3004": Records3004
                Case "3005": Records3005
                Case "3006": Records3006
                Case "3007": Records3007
                Case "3008": Records3008
                Case "3009": Records3009
                Case "3010": Records3010
            End Select
        End With
    End Sub
    it might be a little clumsy but it workd :D thankyou for you help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Conditionally Format Form Control Combo Box?
    By Hornblower in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-20-2013, 04:14 PM
  2. Resetting a form control combo box without using VBA
    By Chris Shepherd in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-22-2013, 10:47 PM
  3. [SOLVED] Want to combine 8 separate form control to a combo box
    By kamaaina in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-11-2013, 12:39 AM
  4. [SOLVED] Hide Rows With Combo Box (Form Control)
    By needexcelhelp123 in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 09-13-2012, 04:10 PM
  5. Assigned Macro to Combo Box(Form Control)
    By pantus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2009, 04:43 PM

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