Running a macro
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Running a macro

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

    Default

     
    Can anyone tell me how to run a Macro based on the value of another cell. Example if cell A1=23, then run macro named print_all. Any help would be greatly appreciated.

  2. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    How about the following code:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Range("a1").Value = 23 Then call print_all
    End Sub

    The code has to be put in the module for the worksheet that the cell is in. The code will call print_all everytime the worksheet is changed and cell A1=23.
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

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

    Default


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

    Default

      
    Al, I will try it immediately. Thanks for the quick help.

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