+ Reply to Thread
Results 1 to 6 of 6

Macro name to run defined by cell

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Macro name to run defined by cell

    You can paste the code below in the ThisWorkbook vba window of the project. It will automatically run the sub red if you type RED in A1. You can add as many of the if lines as you want. A1 is the key range and you can change or expand it to a larger range.

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Dim KeyCells As Range
    
        Set KeyCells = Range("A1")
        
        If Not Application.Intersect(KeyCells, Range(Target.Address)) _
               Is Nothing Then
    
             If KeyCells.Value = "RED" Then red 'Macro to run
            'If KeyCells.Value = "GREEN" Then green ' Macro to run
           
        End If
    End Sub
    Last edited by playaller; 05-25-2014 at 04:11 PM.


    Shelton A.
    If Helpful, Add Reputaion!

+ 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. [SOLVED] Macro to copy selected cell and paste into another (defined) cell.
    By Barking_Mad in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-17-2014, 11:36 AM
  2. Macro to Insert defined integer into range defined by variable criteria
    By stereofeedback in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-06-2013, 12:33 PM
  3. [SOLVED] Macro to add defined text to the end of multiple defined columns of data
    By spikedog in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-28-2012, 05:10 AM
  4. Application-defined or object-defined error with unshare/share macro
    By rlw in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-23-2007, 07:58 AM
  5. Need help with cell defined in Macro
    By Maria in forum Excel General
    Replies: 0
    Last Post: 08-16-2005, 11:05 AM

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