• Changing form object properties (Excel 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Changing form object properties (Excel 2000)

    Author
    Topic
    #384229

    I would like to change the property of a control object based on other input on a form. In my case it should be =IF(x=y,activesheet.checkbox1.visible=”true”,) to turn on a check box only if other criteria are met. All I get is a #NAME? error.

    Any thoughts?

    Viewing 0 reply threads
    Author
    Replies
    • #658363

      To change properties of controls, you must use Visual Basic, not a worksheet formula such as =IF(…).

      Is this about a UserForm (something you create and edit in the Visual Basic Editor), or a form as part of a worksheet?

      • #658557

        Hans

        Thanks. This is a form as part of a worksheet. Objects on the form are placed from the “tools” toolbar. Not being a VB wiz, I might have to look at a different way to get my conditional input.

        Keith

        • #658578

          No need to be a wiz..you can use something like this to activate the checkbox based on cell values.

          Option Explicit
          Private Sub UserForm_Activate()
          If ThisWorkbook.ActiveSheet.Range("a1").Value = "y" Then
              UserForm1.CheckBox1.Enabled = True
          Else: UserForm1.CheckBox1.Enabled = False
          End If
          End Sub
          
          • #658585

            But Keith wrote that he doesn’t use a UserForm, he has a form as part of a worksheet…

            • #658586

              You never let me have any fun! grin I was just pointing out following your suggestion that he use a userform instead of what he is using how he could manipulate the userform controls since he said he wasn’t great at using VBA.

            • #658589

              OK Michael, I agree with you that a UserForm is probably easier.

            • #658588

              My mistake Hans, I thought you suggested he use a userform, but I see you suggested doing it without controls.

        • #658579

          If your “form” is part of a worksheet, you might need code in worksheet events to do what you want. This is far from trivial, even if you’re familiar with VB.

          I recommend that you investigate the possibilities of doing without controls.

    Viewing 0 reply threads
    Reply To: Reply #658586 in Changing form object properties (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:




    Cancel