+ Reply to Thread
Results 1 to 4 of 4

Macro run from If Then function

  1. #1
    Nikki
    Guest

    Macro run from If Then function

    The goal is to run 'MacroX' if cell equals Y. Is that even possible?

  2. #2
    Rick Hansen
    Guest

    Re: Macro run from If Then function


    "Nikki" <[email protected]> wrote in message
    news:[email protected]...
    > The goal is to run 'MacroX' if cell equals Y. Is that even possible?




  3. #3
    Rick Hansen
    Guest

    Re: Macro run from If Then function

    HI Nikki,
    Add the following code the to Worksheet_Change() event on the worksheet
    where the cell is located.

    hth, Rick


    Private Sub Worksheet_Change(ByVal Target as Range)
    If Target.address = "$C$4" and Target.Value = "Y" Then ' <<
    Change cell address
    Call MacroX
    End If
    End Sub




    "Nikki" <[email protected]> wrote in message
    news:[email protected]...
    > The goal is to run 'MacroX' if cell equals Y. Is that even possible




  4. #4
    Lonnie M.
    Guest

    Re: Macro run from If Then function

    Hi, yes it is possible. Place this in the sheet module for the
    worksheet you want to check for 'Y' value:

    Private Sub Worksheet_Change(ByVal Target as Range)
    'Test to see if change ocurred in Cell 'B2'
    If Target.address(0,0) <> "B2" Then exit sub
    'Test if Cell B2 = "Y"
    If Target.value = "Y" Then Call MacroX
    End Sub

    HTH-Lonnie M.


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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