Home Checkbox to select various months
Reply: 0

Checkbox to select various months

user639
1#
user639 Published in July 18, 2018, 10:21 pm

Within a userform, I'm coding a checkbox to select multiple other checkboxes (months). This is to enable the user to select all 12 months rather than clicking through each of them. Following is the code I've written. What have I done wrong now?

Private Sub Selectbox_AfterUpdate()
Dim x As Integer

If Me.Selectbox.Value = True Then
For x = 0 To 12
Me.Controls("Month" & x).Value = True
Next x
Me.Selectbox.Caption = "Deselect All"

ElseIf Me.Selectbox.Value = False Then
For x = 0 To 12
Me.Controls("Month" & x).Value = False

Next x
Me.Selectbox.Caption = "Select All"

End If

End Sub
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308878 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO