Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox1_Click()
Hi
How can i make a value when my checkbox is "on" and another value when it is "off" Regards alvin |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox1_Click()
Hi Alvin,
Try something like: '----------------------------------------- Public myVariable As String Private Sub CheckBox1_Click() If CheckBox1.Value = True Then myVariable = "ON" Else myVariable = "OFF" End If End Sub '------------------------------------------- Regards, Sebastien "Alvin Hansen" wrote: Hi How can i make a value when my checkbox is "on" and another value when it is "off" Regards alvin |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox1_Click()
Same thing but more concise (using the iif function):
'----------------------------------------- Public myVariable As String Private Sub CheckBox1_Click() myVariable = IIf(CheckBox1.Value, "ON", "OFF") End Sub '----------------------------------------- =IIF(Condition, value1, value2) means: if condition is true then return value1 else value2 Regards, Sebastien "sebastienm" wrote: Hi Alvin, Try something like: '----------------------------------------- Public myVariable As String Private Sub CheckBox1_Click() If CheckBox1.Value = True Then myVariable = "ON" Else myVariable = "OFF" End If End Sub '------------------------------------------- Regards, Sebastien "Alvin Hansen" wrote: Hi How can i make a value when my checkbox is "on" and another value when it is "off" Regards alvin |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox1_Click()
|
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox1_Click()
Hi Alvin,
Did this work for you? Regards, Sebastien "sebastienm" wrote: Same thing but more concise (using the iif function): '----------------------------------------- Public myVariable As String Private Sub CheckBox1_Click() myVariable = IIf(CheckBox1.Value, "ON", "OFF") End Sub '----------------------------------------- =IIF(Condition, value1, value2) means: if condition is true then return value1 else value2 Regards, Sebastien "sebastienm" wrote: Hi Alvin, Try something like: '----------------------------------------- Public myVariable As String Private Sub CheckBox1_Click() If CheckBox1.Value = True Then myVariable = "ON" Else myVariable = "OFF" End If End Sub '------------------------------------------- Regards, Sebastien "Alvin Hansen" wrote: Hi How can i make a value when my checkbox is "on" and another value when it is "off" Regards alvin |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox1_Click()
please stay with the thread...otherwise the mail is meaningless
thanks -- Patrick Molloy Microsoft Excel MVP --------------------------------- I Feel Great! --------------------------------- "sebastienm" wrote in message ... Hi Alvin, Did this work for you? Regards, Sebastien "sebastienm" wrote: Same thing but more concise (using the iif function): '----------------------------------------- Public myVariable As String Private Sub CheckBox1_Click() myVariable = IIf(CheckBox1.Value, "ON", "OFF") End Sub '----------------------------------------- =IIF(Condition, value1, value2) means: if condition is true then return value1 else value2 Regards, Sebastien "sebastienm" wrote: Hi Alvin, Try something like: '----------------------------------------- Public myVariable As String Private Sub CheckBox1_Click() If CheckBox1.Value = True Then myVariable = "ON" Else myVariable = "OFF" End If End Sub '------------------------------------------- Regards, Sebastien "Alvin Hansen" wrote: Hi How can i make a value when my checkbox is "on" and another value when it is "off" Regards alvin |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox1_Click()
hmmm... i am in the thread. I am using the MS Web Interface, and i replied
directly by selecting a post within the thread and clicking 'reply'. Also, I can see my reply in the tree of the thread at http://communities2.microsoft.com/co...6-aa815888a213 (not sure the url will work well since it may include session info) I gave up on Outlook Express for this reason. The ms web interface seems to work fine for me. Do you see my reply separartly? Sebastien "Patrick Molloy" wrote: please stay with the thread...otherwise the mail is meaningless thanks -- Patrick Molloy Microsoft Excel MVP --------------------------------- I Feel Great! --------------------------------- "sebastienm" wrote in message ... Hi Alvin, Did this work for you? Regards, Sebastien "sebastienm" wrote: Same thing but more concise (using the iif function): '----------------------------------------- Public myVariable As String Private Sub CheckBox1_Click() myVariable = IIf(CheckBox1.Value, "ON", "OFF") End Sub '----------------------------------------- =IIF(Condition, value1, value2) means: if condition is true then return value1 else value2 Regards, Sebastien "sebastienm" wrote: Hi Alvin, Try something like: '----------------------------------------- Public myVariable As String Private Sub CheckBox1_Click() If CheckBox1.Value = True Then myVariable = "ON" Else myVariable = "OFF" End If End Sub '------------------------------------------- Regards, Sebastien "Alvin Hansen" wrote: Hi How can i make a value when my checkbox is "on" and another value when it is "off" Regards alvin |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox1_Click()
Alvin
Something like Private Sub CheckBox1_Click() Dim myVal As Double If CheckBox1 Then myVal = 1 Exit Sub End If myVal = 2 End Sub Should do it -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England HIS "Alvin Hansen" wrote in message ... Hi How can i make a value when my checkbox is "on" and another value when it is "off" Regards alvin |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox1_Click()
for False = 2, True = 1
Private Sub CheckBox1_Click() Dim myVal As Long myVal =Checkbox1.Value + 2 End Sub for True = 2, False = 1 Private Sub CheckBox1_Click() Dim myVal As Long myVal =(Checkbox1.Value * -1) + 1 End Sub -- Regards, Tom Ogilvy "Nick Hodge" wrote in message ... Alvin Something like Private Sub CheckBox1_Click() Dim myVal As Double If CheckBox1 Then myVal = 1 Exit Sub End If myVal = 2 End Sub Should do it -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England HIS "Alvin Hansen" wrote in message ... Hi How can i make a value when my checkbox is "on" and another value when it is "off" Regards alvin |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox1_Click()
Link it to a cell. The value in the cell will be True when it is checked
and false when it isn't. -- Regards, Tom Ogilvy "Alvin Hansen" wrote in message ... Hi How can i make a value when my checkbox is "on" and another value when it is "off" Regards alvin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|