1

I writing macro for excel on VB. There is a structure:

Forms Form1 Modules Main 

In the Form1 I have Button click event

Public Sub CommandButton1_Click() MsgBox GLOBALVAR 'I need access to GLOBALVAR here End Sub 

In the Main I have procedure Test

Sub Test GLOBALVAR = "VALUE" End Sub 

How I can implement it? I can't create

Module GlobalVariables End Module 

Due to Excel does not support this construction!

1 Answer 1

1

Add a

Public MyGlobalVariable as String

in the Module1

enter image description here

and it becomes accessible in your userform

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.