Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jenn
 
Posts: n/a
Default checkbox and worksheet

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!
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jim Rech
 
Posts: n/a
Default checkbox and worksheet

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
"Jenn" wrote in message
...
|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!


  #3   Report Post  
Posted to microsoft.public.excel.misc
Jenn
 
Posts: n/a
Default checkbox and worksheet

Thanks! I think that will work perfectly! Appreciate the fast response.

"Jim Rech" wrote:

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
"Jenn" wrote in message
...
|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!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox functionality Basia Excel Discussion (Misc queries) 2 June 19th 06 04:42 PM
Can't Get Objects To Work In A Protected Worksheet OMMBoy Excel Worksheet Functions 2 May 27th 06 06:28 PM
Cannot select checkbox to delete it from a spreadsheet Roundy Excel Discussion (Misc queries) 3 November 30th 05 02:38 PM
how do I protect a worksheet and still use a checkbox control JayS Excel Worksheet Functions 4 September 8th 05 07:36 AM
Question when Copying an Existing Worksheet LL Excel Worksheet Functions 0 June 13th 05 03:17 PM


All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"