Toggle button

Bertha

New Member
Joined
Jun 15, 2015
Messages
27
Is it possible to turn a cell into a toggle button?

Thank you for helping out,

Bertha
 
This would be language independent
Code:
.Value = Not(CStr(.Value) = CStr(True))

The toggle column works fine. Question 1: the cells now show the word TRUE for the green cells and FALSE for the red cells. I assume it is not possible to have other words than TRUE and FALSE in the toggle cells?

Question 2: if it is not possible to have other words than TRUE and FALSE, is it possible to make it look like there is no text in these cells, for instance by giving the text characters of the words TRUE and FALSE the same colour as the background?

Thank you in advance,

Bertha
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
It is possible to have words other than True and False.
Actually, I would recommend that the cells get their color from Conditional Formatting rather than by the DoubleClick event.
 
Upvote 0
It is possible to have words other than True and False.
Actually, I would recommend that the cells get their color from Conditional Formatting rather than by the DoubleClick event.

Thank you, I will try to find out how to do that.

Bertha
 
Upvote 0
It is possible to have words other than True and False.
Actually, I would recommend that the cells get their color from Conditional Formatting rather than by the DoubleClick event.

What would be a good way to have only the letters Y en N displayed in respectively the Green and Red cells, instead of the words TRUE and FALSE?

Regards,
Bertha
 
Upvote 0
To use Y/N rather than TRUE/FALSE change this line
Code:
.Value = IIF(CStr(.Value) = "Y", "n", "Y")


And later adjust the testing to set the colors.
 
Upvote 0
IMO, assuming what users will put in a cell (inadvertently or otherwise) is a bold move.
When I do that, it is to set the limitations for the formula or code I am posting... that way the OP knows right away whether he/she can use it or not.
 
Upvote 0
To use Y/N rather than TRUE/FALSE change this line
Code:
.Value = IIF(CStr(.Value) = "Y", "n", "Y")


And later adjust the testing to set the colors.

Thank you Mike, that worked fine when I removed the lines:

If .Value Then
.Interior.Color = RGB(0, 255, 0)
Else
.Interior.Color = RGB(255, 0, 0)
End If

I will lose the colours, as I do not know how to set them (green for Y and red for N), but that is OK, I am happy with the Y/N instead of True/False.

Bertha
 
Upvote 0

Forum statistics

Threads
1,215,391
Messages
6,124,673
Members
449,179
Latest member
fcarfagna

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top