![]() |
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! |
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! |
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! |
All times are GMT +1. The time now is 05:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com