![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Location: Kevin
Posts: 4
|
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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
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.
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Location: Kevin
Posts: 4
|
|
|
|
|
|
|
#4 |
|
New Member
Join Date: Mar 2002
Location: Kevin
Posts: 4
|
Al, I will try it immediately. Thanks for the quick help.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|