Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Button help
I want to create 2 toggle buttons.
1.) Toggle button 1: When it is clicked cell C33 contains an "X" in it. When it is clicked again the "X" goes away and the cell is empty. 2.) Toggle button 2: I want this toggle button to clear out certain cells (a range) and when it is clicked again to put sample data in that range. Sounds simple...but I'm having trouble figuring out how to do it. Thanks for your help! Jonco |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Button help
I put two toggle buttons from the Control toolbox toolbar on a worksheet.
I put this in that worksheet's code module: jonco wrote: I want to create 2 toggle buttons. 1.) Toggle button 1: When it is clicked cell C33 contains an "X" in it. When it is clicked again the "X" goes away and the cell is empty. 2.) Toggle button 2: I want this toggle button to clear out certain cells (a range) and when it is clicked again to put sample data in that range. Sounds simple...but I'm having trouble figuring out how to do it. Thanks for your help! Jonco -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Button help
I put two toggle buttons from the Control toolbox toolbar on a worksheet.
I put this in that worksheet's code module: Option Explicit Private Sub ToggleButton1_Click() If Me.ToggleButton1.Value = True Then Me.Range("c33").ClearContents Else Me.Range("C33").Value = "X" End If End Sub Private Sub ToggleButton2_Click() Dim myRng As Range Dim myArea As Range Set myRng = Me.Range("a3:b9,c12:d18,f19,g1:h3") If Me.ToggleButton2.Value = True Then myRng.ClearContents Else For Each myArea In myRng.Areas With myArea .Formula = "=rand()" .Value = .Value End With Next myArea End If End Sub jonco wrote: I want to create 2 toggle buttons. 1.) Toggle button 1: When it is clicked cell C33 contains an "X" in it. When it is clicked again the "X" goes away and the cell is empty. 2.) Toggle button 2: I want this toggle button to clear out certain cells (a range) and when it is clicked again to put sample data in that range. Sounds simple...but I'm having trouble figuring out how to do it. Thanks for your help! Jonco -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Button help
Thanks. I'll give that a try.
Jonco "jonco" wrote in message t... I want to create 2 toggle buttons. 1.) Toggle button 1: When it is clicked cell C33 contains an "X" in it. When it is clicked again the "X" goes away and the cell is empty. 2.) Toggle button 2: I want this toggle button to clear out certain cells (a range) and when it is clicked again to put sample data in that range. Sounds simple...but I'm having trouble figuring out how to do it. Thanks for your help! Jonco |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need to Use 1 Button to toggle On or Off | Excel Discussion (Misc queries) | |||
Need help using a toggle button | Excel Programming | |||
Toggle Button | Excel Worksheet Functions | |||
Toggle button | Excel Discussion (Misc queries) | |||
Adding .xla button for Toggle Calculation Button | Excel Programming |