How do I...
How do I...
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: How do I...

  1. #1
    Guest

    Default

     
    ...tell Excel to run a macro based on information entered into a specific cell? Eg if user enters N run the macro, if they enter Y do nothing.

    Thanks in advance!

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'm assuming that the value Y/N value will go in cell "A1".

    Right click on the sheet tab and select "View Code".

    Insert this code:


    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$1" And UCase(Target.Value) = "N" Then
    MsgBox "Hi"
    End If
    End Sub


    Change the 'Target.Address = "$A$1"' to whatever cell you need it to be.
    Change the 'msgbox "hi"' line to the name of the macro you want to run.

    HTH

  3. #3
    Guest

    Default

    Thanks very much, this works fine! Now it does what I want is there a way to get the cell selector to move two cells to the right after the macro has run? For example, I put an N in A1, the macro runs, then I want the cell selector to move to cell C1.

  4. #4
    New Member
    Join Date
    Mar 2002
    Posts
    37
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    ActiveCell.Offset(rowOffset:=0, columnOffset:=2).Select

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com