Passing Public Module Vairable to a Worksheet Event

  • Thread starter Thread starter SMS - John Howard
  • Start date Start date
S

SMS - John Howard

Can any tell me how to pass a module declared variable toa worksheet event.
In this instance a Before Double Click event

TIA

John Howard
Sydney, Australia
 
This is an example:

1. Insert a module and declare a variable

Public Const xx = 100

2. In your Sheet module, the event is:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
MsgBox Module1.xx
End Sub

The MsgBox line prefixes the reference to the variable xx by the module
name. If you have only one module, the prefix is unnecessary although its
presence may be helpful in debugging.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top