Results 1 to 9 of 9

Execute macro based on cell value

Threaded View

  1. #1
    Registered User
    Join Date
    01-26-2011
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    49

    Execute macro based on cell value

    Hi,

    I have a combo box on Sheet5 where the user chooses one of two options. The combo box spits out "1" or "2" in cell AA7. Then I have two macros: "SPOR" and "Avg_Chk", which change a bunch of calculations on the sheet. I would like the "SPOR" macro to be executed if the value in AA7 is "1" and the "Avg_Chk" macro when the value in AA7 is "2".

    I googled and found lots of answers and solutions for this, but when I try to apply them to my worksheet nothing happens when I change the combo box. This is the code I found:

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Range("AA7")) Is Nothing Then
            Select Case Range("AA7")
                Case "1": SPOR
                Case "2": Avg_Chk
            End Select
        End If
        End Sub
    I add this to the code of Sheet 5. Macro "Spor" and "Avg_Chk" are saved in a module.

    My apologies, I know little to nothing of VBA. I'm sure this is a very obvious mistake and I'm sorry for my noobishness :D

    Thank you for your help!

    Cheers

    M.
    Last edited by Maike; 07-25-2017 at 08:39 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to execute based on a cell value change - if enter is not pressed
    By DJDRU in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-01-2016, 11:52 PM
  2. Execute different equations based on the value of a single cell
    By s86design in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-24-2016, 01:33 PM
  3. Execute a macro in a closed workbook, or open and execute without the user noticing
    By cearaujo123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-09-2015, 06:44 PM
  4. Execute code based on cell entry
    By rkjudy in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-29-2009, 01:38 PM
  5. [SOLVED] How do I execute a macro based on the value of a cell in Excel?
    By brettopp in forum Excel General
    Replies: 12
    Last Post: 06-16-2006, 08:30 PM
  6. How can I get a macro to execute in excel based on the value of a.
    By Ian P in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-19-2005, 05:06 PM
  7. Execute Events Based Upon Selected Cell
    By D.Parker in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-22-2005, 11:07 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