![]() |
![]() |
|
|||||||
| 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 |
|
Guest
Posts: n/a
|
...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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
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:
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 |
|
Guest
Posts: n/a
|
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 |
|
New Member
Join Date: Mar 2002
Posts: 37
|
ActiveCell.Offset(rowOffset:=0, columnOffset:=2).Select
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|