Results 1 to 1 of 1

Thread: Run Macro Based On Combobox Selection
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Apr 2016
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Run Macro Based On Combobox Selection

    Don't let the title confuse you, this is more complex than you think..... I have a combobox with code:
    (FYI this code works perfectly No Changes please)

    Code:
    Sub UserForm_Initialize()
    With ComboBox2
    .AddItem Worksheets("Sheet3").Range("A17").Value
    End With
    End Sub
    However, Imagine that there are several extra items in this list. Range A17 will change regularly to a different set of terms/items along with all the other add items (each will be calling from a different cell (and possibly sheet), and will have different information) I need a code that will allow me to run a macro based on the selection with this in mind, and as the name changes all the time using format:

    Code:
    If Me.Combobox2.Value = "(Static Text)" Then
    Call "macro name"
    Range("B2").Select
    End If
    Won't work, as cell A17 will rarely if ever equal the same thing more than 1 time and changes every 10-15mins. I am thinking the code might be similar to:

    Code:
    If Me.Combobox2.Value = "Worksheets("Sheet3").Range("A17").Value" Then
    Call "macro name"
    Range("B2").Select
    End If
    However that does not work.... Please Help...

    EDIT: (I think I got it, any suggestions)

    Code:
    If Me.Combobox2.Value = Worksheets("Sheet3").Range("A17").Value Then
    Call "macro name"
    Range("B2").Select
    End If
    Last edited by Guard913; Aug 18th, 2019 at 02:55 PM. Reason: I fixed it I think

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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