Private Sub

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

seacrest

Active Member
Joined
Aug 15, 2002
Messages
301
Sorry i was not to clear.I just dont want my macros shown at all but i want to be able to reference them
Is it possible
 

Ivan F Moala

MrExcel MVP
Joined
Feb 10, 2002
Messages
4,209
On 2002-09-07 02:02, seacrest wrote:
Sorry i was not to clear.I just dont want my macros shown at all but i want to be able to reference them
Is it possible

If you don't want your macros to show then
Place Option Private Module @ the top
of your Module with the routines you want hidden from view.
 
L

Legacy 98055

Guest
I see...
Place all of your macros in a class module.
For example:
From the VBE...
Click on "Insert", "Class Module".
Rename the Class to "MyMacros"
Declaring a Public procedure in this class module creates a "Method" for this class. Place the following in your new class.

Public Sub One()
MsgBox "This method/macro is not visible..."
End Sub

You can invoke this "Method" of your newly created class from a "Private" procedure elsewhere in your project as such...

Private Sub Two()
Dim mm As New MyMacros
mm.One
End Sub

If you need further clarification, please reply.

Tom

PS.
I saw Ivan's easier solution after posting... Note that using "Option Private" will make the procedures in this module unavailable to other applications and other projects which may or may not apply in your case.
This message was edited by TsTom on 2002-09-07 02:20
 

XL-Dennis

Well-known Member
Joined
Jul 27, 2002
Messages
1,920
seacrest,

If You want to hide Your macros from being viewed and still want to call them then You may consider to turn the sub-procedures to functions, i e

Sub Test()
.....
End Sub

Function Test()
.....
End Sub

Kind regards,
Dennis
 

Watch MrExcel Video

Forum statistics

Threads
1,129,553
Messages
5,636,989
Members
416,953
Latest member
broexc

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