• User Form Caption (Excel 2000)

    Author
    Topic
    #416532

    I am using Excel’s Visual Basic Editor to create a User Form and would like to add a variable to a Label caption. Is this possible? Something like: Your entry does not match the worksheet value of myVar is this correct?

    In this case I would prefer the User Form to a Message Box.
    Thanks

    Viewing 1 reply thread
    Author
    Replies
    • #932069

      You can set the caption of a label in code, for example in the Initialize event of the userform.

      Private Sub UserForm1_Initialize()
      Me.Label1.Caption = “Your entry does not match ” & myVar & “. Is this correct?”
      End Sub

      or

      Private Sub UserForm1_Initialize()
      Me.Label1.Caption = “Your entry does not match ” & Worksheets(“Sheet1”).Range(“C37”).Value & “. Is this correct?”
      End Sub

    • #932070

      Yes, like this:

      sStr=”And This Is A Variable Part Of The Caption”
      Userform1.Caption=”This Is The Caption Of This Form ” & sStr

      ########edited: misread the question##############

      Oh well, at least this shows you how to change the caption of the form itself

    Viewing 1 reply thread
    Reply To: User Form Caption (Excel 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: