Archive of Mr Excel Message Board
Back to Excel VBA archive index
Back to archive home
Passing Parameters Posted by Bob on August 28, 2001 2:07 PM
Anyone know if it is possible to pass a parameter to the code in
a sheet? In other words, If a click event happens, then Parameter
MyParm = True
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range, ByVal MYPARM as Boolean)
If MyPARM = True then
Do some Code
Don't do my Code
But it didn't work.
|Check out our Excel VBA Resources
Re: Passing Parameters Posted by Russell Hauf on August 28, 2001 3:02 PM
You can just use a global variable. Above your Worksheet_SelectionChange event, just declare MyParm:
Private MyParm as Boolean
Then in your click event, you can set it.
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If MyParm Then
' Do Something
' Do something else
Hope this helps,
This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store
to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.