ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Toggel Boxes (https://www.excelbanter.com/excel-discussion-misc-queries/1939-toggel-boxes.html)

Aviator

Toggel Boxes
 
I am wanting to be able to make toggel boxes that:
1. Toggels between 2 colors (White & Yellow).
2. Toggels between 2 values (0 & 1)

(ie. When the toggel is white the value for that cell is 0 and when the
toggel is yellow the value for the cell is 1)

Note: I need to be able to use these values for a formula somewhere else.


I am not quite sure what a toggle box is but try this on a
button.
Private Sub ToggleButton1_Click()
If ToggleButton1.BackColor = &HFFFFFF Then
ToggleButton1.BackColor = &HFFFF&
ToggleButton1.Caption = "1"
Else
ToggleButton1.BackColor = &HFFFFFF
ToggleButton1.Caption = "0"
End If
If Range("h4").Value = 1 Then
Range("H4").Value = 0
Range("H4").Interior.ColorIndex = 2
Else
Range("H4").Value = 1
Range("H4").Interior.ColorIndex = 6
End If
end sug
have fun.

-----Original Message-----
I am wanting to be able to make toggel boxes that:
1. Toggels between 2 colors (White & Yellow).
2. Toggels between 2 values (0 & 1)

(ie. When the toggel is white the value for that cell is

0 and when the
toggel is yellow the value for the cell is 1)

Note: I need to be able to use these values for a formula

somewhere else.
.



All times are GMT +1. The time now is 11:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com