checkbox and worksheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am a newbie at VBA (I have written a few small macros) and was hoping
someone might be able to help with this task.
I have 3 worksheets: worksheet A, worksheet B, and worksheet C.
On worksheet A I have 3 checkbox controls and a button that I have pulled
from the VBA controls toolbar. What I want is to have a macro do the
following:

If the first 2 checkboxes are checked and the button is pushed, take the
user to worksheet B, if the first and third checkboxes are checked and the
button is pushed, take the user to worksheet C.

In the long run there will be a lot more checkboxes and combinations on what
sheets to go to but I thought this example would give me enough to modify as
I went along.
Is this tough to do? Any help would be greatly appreciated.
TIA!
 
This would be a start:

Sub Button4_Click()
If ActiveSheet.CheckBoxes("Check Box 1").Value = xlOn Then
If ActiveSheet.CheckBoxes("Check Box 2").Value = xlOn Then
Worksheets("Sheet2").Activate
ElseIf ActiveSheet.CheckBoxes("Check Box 3").Value = xlOn Then
Worksheets("Sheet3").Activate
End If
End If
End Sub


--
Jim
|I am a newbie at VBA (I have written a few small macros) and was hoping
| someone might be able to help with this task.
| I have 3 worksheets: worksheet A, worksheet B, and worksheet C.
| On worksheet A I have 3 checkbox controls and a button that I have pulled
| from the VBA controls toolbar. What I want is to have a macro do the
| following:
|
| If the first 2 checkboxes are checked and the button is pushed, take the
| user to worksheet B, if the first and third checkboxes are checked and the
| button is pushed, take the user to worksheet C.
|
| In the long run there will be a lot more checkboxes and combinations on
what
| sheets to go to but I thought this example would give me enough to modify
as
| I went along.
| Is this tough to do? Any help would be greatly appreciated.
| TIA!
 
Back
Top