Private Sub

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
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
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,249
Members
448,879
Latest member
oksanana

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