Userform display control

UHsoccer

Well-known Member
Joined
Apr 3, 2002
Messages
1,004
Using the following code to show/hide Labels and OptionButtons on a Userform

Code:
UserForm1.Label5.Visible = False
UserForm1.OptionButton2.Visible = False
They still show, any ideas
?
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
7,861
Office Version
2007
Platform
Windows
The instructions are correct. As long as the userform1 is visible.


And at what time do you run those lines? when do you press a button?
Or what must happen to run those lines?
 

UHsoccer

Well-known Member
Joined
Apr 3, 2002
Messages
1,004
Checked throughout but could not locate any, Here is a copy of the code

Code:
If Sheets("CtlPgm").Range("BB7") = 0 Then ' no Obsolete  UserForm1.Label5.Visible = False
        UserForm1.OptionButton1.Visible = False
        UserForm1.OptionButton2.Visible = False
        UserForm1.Label5.Visible = False
        UserForm1.Label5.Caption = "Obs-- (0)"
        If msgShowHide = "Yes" Then Auto_Trace "In-Form1-Init hide Obsolete CtlPgm-BB7 Label5, Button 1,2"
    Else
        UserForm1.OptionButton1.Visible = True
        UserForm1.OptionButton2.Visible = True
        UserForm1.Label5.Caption = "Obs- (" & Sheets("CtlPgm").Range("BB7") & ")"
        UserForm1.Label5.Visible = True
        If msgShowHide = "Yes" Then Auto_Trace "In-Form1-Init show Obsolete " & Sheets("CtlPgm").Range("BB7") & "  Label 5, Button 1,2"
    End If
Private Sub CommandButton2_Click() ' manage data from button on sheet1

'Auto_Trace "CommandButton2-click - Userform1-show "
Sheets("Sheet1").CommandButton2.BackColor = RGB(102, 255, 0) ' Green
UserForm1.Show

End Sub
 
Last edited:

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
7,861
Office Version
2007
Platform
Windows
And what do you have in this cell?

Code:
[COLOR=#333333]Sheets("CtlPgm").Range("BB7") = 0[/COLOR]
But I still don't see when it goes through these lines.

If you like, you can check your file.

You could upload a copy of your file to a free site such www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.
 

Forum statistics

Threads
1,078,310
Messages
5,339,417
Members
399,303
Latest member
Plczrode

Some videos you may like

This Week's Hot Topics

Top