+ Reply to Thread
Results 1 to 3 of 3

Run Macro based on cell value

  1. #1
    Forum Contributor
    Join Date
    01-14-2004
    Location
    India
    MS-Off Ver
    365
    Posts
    264

    Run Macro based on cell value

    Hi everyone!
    Good Morning.
    How can I run a macro based on the value of a cell.
    I have restricted the entry in cell A1 either "Y" or "N" using data validation.
    What I need- if the value in A1="Y" then run macro1
    If the value in A1="N", then run macro2

    Is there anyway??
    Thanks
    Last edited by SMILE; 09-06-2011 at 04:27 AM.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Run Macro based on cell value

    Yes, you'll need some code in the sheet change event for that sheet.

    Open the VB editor and double click on the sheet name which is going to hold the Y/N value in the left hand pane.

    In the drop-down box at the top-left of the main editor select "Worksheet"

    In the right-hand drop down select "Change"

    You'll get some code that looks like this:

    Please Login or Register  to view this content.

    Edit this code to read:

    Please Login or Register  to view this content.

    That should be it.

  3. #3
    Forum Contributor
    Join Date
    01-14-2004
    Location
    India
    MS-Off Ver
    365
    Posts
    264

    Re: Run Macro based on cell value

    Andrew!!!
    This is the second time you are helping me with codes!!!
    Its working perfect... Thanks a loooottt..
    Add to reputation

+ 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