Private Sub SetControls(State As Boolean, Tg1 As String, Optional Tg2 As String, Optional Tg3 As String, _ Optional Tg4 As String, Optional Tg5 As String, Optional Tg6 As String) On Error GoTo Err_Handler 'set controls to visible or not according to the control tag value For Each ctrl In Me.Controls If ctrl.Tag = Tg1 Or ctrl.Tag = Tg2 Or ctrl.Tag = Tg3 Or ctrl.Tag = Tg4 _ Or ctrl.Tag = Tg5 Or ctrl.Tag = Tg6 Then ctrl.visible = State Next ctrl Exit_Handler: Exit Sub Err_Handler: 'create error message & log strProc = Application.VBE.ActiveCodePane.CodeModule.ProcOfLine(Application.VBE.ActiveCodePane.TopLine, 0) PopulateErrorLog Resume Exit_Handler End Sub In the Form_Load event, add code to set the start up properties like this: SetControls True, "A" SetControls False, "E", "S", "Q", "P", "V" SetControls False, "F", "FB", "R", "FR", "RB"
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter