Initialize Checkbox Name

  • Hi All,


    I want to load a userform with 2 checkboxes. I want the Checkboxes text to equal whatever is in two specific cells on my spreadsheet. i.e. I want to initialise the checkbox text to be the vale of cell A1 and A2 on sheet 1 when I load the userform. To load my userform I am using





    and then I thought on the userform I would use the following private function but this isnt working.




    Code
    Private Sub UserForm_Initialize()
    
    
    Bmth_CheckBox.Name = Data.Range("A9").Value
    Dub_CheckBox.Name = Data.Range("A10").Value
         
    End Sub




    Can anyone tell me what i'm doing wrong.




    Thanks




    James

  • Re: Initialize Checkbox Name


    The property you are looking for is .Caption.

    Code
    Private Sub UserForm_Initialize() 
         
        Bmth_CheckBox.Caption = Data.Range("A9").Value 
        Dub_CheckBox.Caption = Data.Range("A10").Value 
         
    End Sub


    Is Data a public variable?

  • Re: Initialize Checkbox Name


    Ah, Glad it was something simple!


    Great Stuff, thanks very much for your help.


    Data is the Codename of the sheet rather than the sheet Tab name.


    Thanks again for your help!!


    James

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!