ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Option group controlling objects (https://www.excelbanter.com/excel-programming/442670-option-group-controlling-objects.html)

Brian

Option group controlling objects
 
Hello All,

Is there a faster way of doing the following. It's kind of choppy when the
objects disappear then reappear. I'm sure it's pretty obvious what I'm trying
to do.

Private Sub OptionButton1_Click()
If OptionButton1.Value = True Then
Label3.Visible = False
Label4.Visible = False
Label5.Visible = False
Label6.Visible = True
ComboBox1.Visible = False
ComboBox2.Visible = False
ComboBox3.Visible = False
ComboBox4.Visible = True
Label7.Visible = True
Label8.Visible = True
ComboBox5.Visible = True
ComboBox6.Visible = True
End If
End Sub

Private Sub OptionButton2_Click()
If OptionButton2.Value = True Then
Label3.Visible = True
Label4.Visible = True
Label5.Visible = True
Label6.Visible = True
ComboBox1.Visible = True
ComboBox2.Visible = True
ComboBox3.Visible = True
ComboBox4.Visible = True
Label7.Visible = False
Label8.Visible = False
ComboBox5.Visible = False
ComboBox6.Visible = False
End If

Thanks in advance

--
Brian

Rick Rothstein

Option group controlling objects
 
(Untested) You could try putting this line at the beginning of **each** of
your Click events...

Application.ScreenUpdating = False

and putting this line at the end of **each** of your Click events...

Application.ScreenUpdating = True

--
Rick (MVP - Excel)



"Brian" wrote in message
...
Hello All,

Is there a faster way of doing the following. It's kind of choppy when the
objects disappear then reappear. I'm sure it's pretty obvious what I'm
trying
to do.

Private Sub OptionButton1_Click()
If OptionButton1.Value = True Then
Label3.Visible = False
Label4.Visible = False
Label5.Visible = False
Label6.Visible = True
ComboBox1.Visible = False
ComboBox2.Visible = False
ComboBox3.Visible = False
ComboBox4.Visible = True
Label7.Visible = True
Label8.Visible = True
ComboBox5.Visible = True
ComboBox6.Visible = True
End If
End Sub

Private Sub OptionButton2_Click()
If OptionButton2.Value = True Then
Label3.Visible = True
Label4.Visible = True
Label5.Visible = True
Label6.Visible = True
ComboBox1.Visible = True
ComboBox2.Visible = True
ComboBox3.Visible = True
ComboBox4.Visible = True
Label7.Visible = False
Label8.Visible = False
ComboBox5.Visible = False
ComboBox6.Visible = False
End If

Thanks in advance

--
Brian




All times are GMT +1. The time now is 07:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com