Can a macro call Worksheet VBA Code

DogsbodyBoy

New Member
Joined
Oct 24, 2022
Messages
20
Office Version
  1. 365
Platform
  1. Windows
My understanding is that VBA code on a worksheet (right-click on Worksheet table and select View Code) will run automatically every time a value is entered into the active cell and then accepted with the enter key. Is it possible to have the VBA code on the worksheet called from a macro so that it runs on the active cell at the time the macro calls it? I guess another way of wording the question is to say that I want the macro to replicate hitting the enter key so the Worksheet VBA code then runs.

Thanks for any help.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
The best way to do that would be to put the routine into a normal module and have it called both from your worksheet event code and from your macro.
 
Upvote 0
Solution
Thanks, Rory. I was thinking too deep; your suggestion is the correct approach.
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

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
Back
Top