Is gosub the answer

rhino4eva

Active Member
Joined
Apr 1, 2009
Messages
262
Office Version
  1. 2010
Platform
  1. Windows
i have three macros contained in a single worksheet
1= a validation macro
2= a printout macro
3= a save macro

i want to be able to validate then print as well as validate and save
the easy wasy is to copy the validate macro and paste it in front of each of the other 2 macros. But that seems messy and duplicates code. I feel i should be using a gosub at the start osf 2 and 3 but i am not sure how to implement it. anyone got any ideas ???
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
GoSub wouldn't work if you want to call code in a separate sub.

You should probably avoid it anyway.

There are various ways you could approach this.

For example you could have code at the end of the validation that calls either the print macro or the save macro, or both.
 
Upvote 0
thanks VoG

just to clarify the macro is called CheckNUM

so i need a line in the start of 2 and 3

Call CheckNUM

which will run CheckNUM and then run the code in 2 or 3
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,704
Members
452,938
Latest member
babeneker

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