+ Reply to Thread
Results 1 to 2 of 2

Checkbox must stay checked

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Moscow
    MS-Off Ver
    Excel 2010
    Posts
    291

    Checkbox must stay checked

    Hi all!

    This is the code of all module
    
    Dim a As Boolean
    
    
    Sub Check_errors_Click() 'checkbox created in vba, part of user form
    If Check_errors.Value = True Then ' If checked then....
         a = 1
    End If
    End Sub
    
    Sub Execute_selected_code_Click()' control button on the same userform
    
    If a = True Then                           'if checkbox was checked then call.....
        Call Check_for_errors
    End If
    
    End Sub
    
    Sub ShowMenu1()                        'if userform opened again, check what value of a is a show checkbox accordingly. 
        Check_errors.Value = 1
        Userform1.Show
    End Sub
    So if Check_errors.Value = True - checkbox checked, then if i press control button "execute code" then it call some macro. if i open userform (menu) next time then checkbox gets value stored in a, that's why a declared before all subs. The problem that i cant succeed to assign a value to checkbox value, meaning that checkbox whatsoever is always unchecked. Please help and thanks in advance !!
    Last edited by Alexander_Golinsky; 08-27-2012 at 08:33 AM.

  2. #2
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Moscow
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: Checkbox must stay checked

    I had this code:
    
    Sub ShowMenu1()                        'if userform opened again, check what value of a is a show checkbox accordingly. 
        Check_errors.Value = 1
        Userform1.Show
    End Sub
    in main module too, that's why it worked at all.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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