Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make a formula work for the whole column claudia Excel Discussion (Misc queries) 6 August 11th 08 06:48 PM
Add to this formula to make it work jeannie v Excel Worksheet Functions 3 April 4th 08 03:03 PM
Can't make the division work in my formula jeannie v Excel Worksheet Functions 3 March 7th 08 06:18 PM
FORMULA FOR EXPERT, PLS MAKE THIS WORK Moh Excel Programming 3 June 16th 06 03:02 PM
FORMULA FOR EXPERT, PLS MAKE THIS WORK Blue Aardvark Excel Programming 0 June 15th 06 06:22 PM


All times are GMT +1. The time now is 06:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"