Use single procedure for multiple worksheets.

I have a workbook used for evaluating expenses for a single month. For each month i have a separate worksheet with a "Start Process" button. Currently this button calls a routine called "Private Sub Start_Process_Click()". When i add a new sheet (via a copy of an existing sheet), i get another version of the same routine.

I am new to vba, so please excuse my ignorance if this is a simple question, but i don't know how to call the same procedure from each sheet, so that i only have a single procedure that is used for all the worksheets.

February 3rd, 2015 11:21am

Hi,

You can try the following. Go to the VBA editor. From the insert menu choose "module". Copy your private sub to that module. When done change the word "private" to "public". So you should have "Public sub Start_Process". Now from your worksheet change the button action to call the Start_Process routine. You can do this for every worksheet. They can now all use the same sub routine you created.

Free Windows Admin Tool Kit Click here and download it now
February 3rd, 2015 1:16pm

That worked fine, thanks
February 3rd, 2015 2:38pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics