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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

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.
 
Upvote 0

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
 
Upvote 0

Forum statistics

Threads
1,187,187
Messages
5,962,095
Members
438,583
Latest member
DJTCharts

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