![]() |
Make a formula work with a checkbox
Hi,
I have a macro that hides and unhides a certain number of columns using a checkbox. Now, I'm I want to create a formula in a cell that links to this check box. In other words, if the checkbox is checked then I want the formula to work one way, and if it's not checked then I want the formula to work another way. This is the code: Private Sub CheckBox1_Click() If CheckBox1.Value = True Then Sheets("Summary").Columns("AS:BD").EntireColumn.Hi dden = False Else Sheets("Summary").Columns("AS:BD").EntireColumn.Hi dden = True End If End Sub Thanks Miguel |
Make a formula work with a checkbox
link your checkbox to an unused cell then change your formula to an IF to
evaluate the checkbox state - something like this: =IF(A1,"Checked","Not Checked") -- jb "Miguel" wrote: Hi, I have a macro that hides and unhides a certain number of columns using a checkbox. Now, I'm I want to create a formula in a cell that links to this check box. In other words, if the checkbox is checked then I want the formula to work one way, and if it's not checked then I want the formula to work another way. This is the code: Private Sub CheckBox1_Click() If CheckBox1.Value = True Then Sheets("Summary").Columns("AS:BD").EntireColumn.Hi dden = False Else Sheets("Summary").Columns("AS:BD").EntireColumn.Hi dden = True End If End Sub Thanks Miguel |
Make a formula work with a checkbox
hi,
if you have code, i'm assuming that you are using the check box from the control toolbox. the check box has a linked cell property. this will produce a true/false in the linked cell when the check box is checked or not. assuming that the linked cell is A1, your fomula might then looks something like this. =IF(A1=TRUE, "work one way","work another way") note that the word true has no quotes. Regards FSt1 "Miguel" wrote: Hi, I have a macro that hides and unhides a certain number of columns using a checkbox. Now, I'm I want to create a formula in a cell that links to this check box. In other words, if the checkbox is checked then I want the formula to work one way, and if it's not checked then I want the formula to work another way. This is the code: Private Sub CheckBox1_Click() If CheckBox1.Value = True Then Sheets("Summary").Columns("AS:BD").EntireColumn.Hi dden = False Else Sheets("Summary").Columns("AS:BD").EntireColumn.Hi dden = True End If End Sub Thanks Miguel |
Make a formula work with a checkbox
Thanks, it works
"FSt1" wrote: hi, if you have code, i'm assuming that you are using the check box from the control toolbox. the check box has a linked cell property. this will produce a true/false in the linked cell when the check box is checked or not. assuming that the linked cell is A1, your fomula might then looks something like this. =IF(A1=TRUE, "work one way","work another way") note that the word true has no quotes. Regards FSt1 "Miguel" wrote: Hi, I have a macro that hides and unhides a certain number of columns using a checkbox. Now, I'm I want to create a formula in a cell that links to this check box. In other words, if the checkbox is checked then I want the formula to work one way, and if it's not checked then I want the formula to work another way. This is the code: Private Sub CheckBox1_Click() If CheckBox1.Value = True Then Sheets("Summary").Columns("AS:BD").EntireColumn.Hi dden = False Else Sheets("Summary").Columns("AS:BD").EntireColumn.Hi dden = True End If End Sub Thanks Miguel |
All times are GMT +1. The time now is 07:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com