Hi Guys,
How to call global variable from UserForm in the module.
This is my userform.
UserForm.png
I have written following codes for userform.
Public AnalysisVar As String
Private Sub UserForm_Initialize()
ChartAnalysisButton.Value = True
End Sub
Private Sub AnalysisOK_Click()
If ChartAnalysisButton.Value = True Then
AnalysisVar = "Chart"
Else
AnalysisVar = "Table"
End If
AnalysisTypeForm.Hide 'To close the form after clicking OK.
End Sub
Private Sub AnalysisCancel_Click()
Unload Me
End Sub
Then I am calling this userform from the module.
Sub PrintVar()
AnalysisTypeForm.Show
MsgBox (AnalysisVar)
End Sub
But When it completes the excution of AnalysisTypeForm.Show the value of AnalysisVar become null. And I get an empty message box. Guys please help me. where i am doing wrong. 
Thanks & Regards,
Vikas Agrawal
Bookmarks