Results 1 to 11 of 11

Combo box selection to call macro

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Combo box selection to call macro

    Please see attached file. I've created a combo box that is linked to a cell such that whatever listing is visible in the combo box also appears in the linked cell (E2). I have recorded a macro that sorts for "goat"s in a column of animals. I need to know how to call this macro when the linked cell reads "Dehorn goats". (BTW, these are all just silly examples to illustrate my challenge with a much bigger spreadsheet....)

    Here's what's curious: when I select "Dehorn goats" in the combobox list it does not perform the sorting. But, after selecting this, if I then click on random cells, the second or third cell I double click runs the macro. I cannot figure out why, and there doesn't seem to be a consistent pattern in which cells work to activate the macro, either. Very strange. What am I doing wrong? I sense it has something to do with the recorded macro being in a Module rather than the sheet I'm working in, but I've tried cutting and pasting it into the sheet code with no luck.

    Below is the macro I've scripted to call the SortGoat macro I recorded. (and which does work when run on its own...)
    Private Sub Worksheet_Change(ByVal Target As Range)
    Set Target = Range("E2")
    If Target.Value = "Dehorn goat" Then
        Call SortGoat
    End If
    End Sub
    Thanks for your help, I really need it. David
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Want to call Macro when cell changes as a result of Combo Box Choice
    By CRIMEDOG in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-15-2012, 09:26 PM
  2. Run a macro based on a Combo Box Selection
    By DBHaley in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2011, 03:32 AM
  3. Combo Box Change Event with Macro Call
    By Bosco6 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-21-2011, 02:40 PM
  4. [SOLVED] macro to blank combo box selection
    By elevdown in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2008, 06:58 AM
  5. call macro from combo box
    By minkus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2007, 12:14 PM

Tags for this Thread

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