+ Reply to Thread
Results 1 to 2 of 2

Setting Global Variables from UserForm

  1. #1
    Registered User
    Join Date
    12-13-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    2

    Post Setting Global Variables from UserForm

    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

  2. #2
    Registered User
    Join Date
    12-13-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Setting Global Variables from UserForm

    Hi Guys, Plz reply, this is very urgent

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1