Starting a Module from a Userform

Cease

Board Regular
Joined
Dec 28, 2010
Messages
112
Hi,
I have a userform that runs a macro from code set on individual worksheets.
What I'd rather do is have it run from a module, so I can use the same module for multiple sheets.

I have this:
Code:
 If ActiveSheet.Range("h224").Value = "T" Then
            Range("D3:I3").Select
            ActiveCell.Value = Range("AK8").Value
            Run ("Sheet5.Mailout")
        End If

How to I change this to run a module (same name: Mailout) instead of from the sheet.

I apologize in advance, I know this is basic, but I'm burned out from a previous search and haven't been able to find the answer to this anywhere else.

Thanks in advance!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
If the code is not in a sheet class module just remove Sheet5.

You might also need to change how the sub from Private to Public.

By the way, I'm assuming it is an actual Sub you are referring to and not the name of a module.

If the module is called Mailout you'll need to use the name of the sub within the module, which shouldn't have the same name as the module.
 
Upvote 0
Norie,

That nailed it. Not sure what I had been trying, but I was overcomplicating it.

Thank you so much!
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,445
Members
452,915
Latest member
hannnahheileen

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