run macro after pressing enter

y481184

Board Regular
Joined
Aug 1, 2003
Messages
137
Is there a way to get a macro to run after pressing enter upon completion of a particular cell? I have 6 cells that collectively (along with several if statements) determine the output that will be placed in a different cell on the worksheet. I would like the macro to fire when the user presses enter or tabs past the last cell needed to complete the calculation. I hope this is clear, can anyone help?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

TommyGun

MrExcel MVP
Joined
Dec 9, 2002
Messages
4,202
Sure. You can use a Worksheet_SelectionChange event to determine when to fire your code. Do a search on this board for this event, or look in the VB help documentation for more information.
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,456
TommyGun is right.
However if you have your "Move selection after enter" option disabled (Tools > Options > Edit tab) then I think you'll need a copy of your macro in a Worksheet_Change sub also to get it to fire when Enter is pressed.

Dan
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,322
Messages
5,769,446
Members
425,546
Latest member
DisMissive

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top