Check box and Command button code

T

Todd

This code will change the named range of cells yellow when
the check box is checked and the command button is pressed
which is what I want it to do, but when you check the
check box, it will take the user over to my second
worksheet named form where the range of cells are. I
would like for it to wait to take them over after they
press the command button because multiple check boxes will
need to be checked. Any help is greatly appreciated.

Option Explicit

Private Sub CommandButton1_Click()
Call CheckBox2_Click
End Sub

Private Sub CheckBox2_Click()
If Me.CheckBox2.Value = False Then Exit Sub
Sheets("Form").Activate
ActiveSheet.Range("Address").Select
If Selection.Interior.Pattern = xlNone Then
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Else
With Selection.Interior
.Pattern = xlNone
End With
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top