ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CheckBox1_Click() (https://www.excelbanter.com/excel-programming/311450-checkbox1_click.html)

Alvin Hansen[_2_]

CheckBox1_Click()
 
Hi

How can i make a value when my checkbox is "on"
and another value when it is "off"

Regards
alvin


sebastienm

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


Tom Ogilvy

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




Nick Hodge

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




sebastienm

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


Nick Hodge

CheckBox1_Click()
 
Sebastien

Like that one

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"sebastienm" wrote in message
...
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




sebastienm

CheckBox1_Click()
 
Thanks Nick.
Seb

"Nick Hodge" wrote:

Sebastien

Like that one

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"sebastienm" wrote in message
...
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





Tom Ogilvy

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






sebastienm

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


Patrick Molloy[_4_]

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




sebastienm

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





Patrick Molloy[_4_]

CheckBox1_Click()
 
indeed
:)

--
Patrick Molloy
Microsoft Excel MVP
---------------------------------
I Feel Great!
---------------------------------
"sebastienm" wrote in message
...
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







sebastienm

CheckBox1_Click()
 
I am just curious, Patrick, what are you using to read/post-to newsgroups?
Outlook/MSWebInterface/Google...?
MS Outlook Express was un-manageable to me due to a not-that-good
conversation view. (but maybe it was because i hadn't loaded enough threads
yet... not sure)
MS Web Interface is pretty nice to me but it takes forever to refresh the
page and there is (i believe) no automatic notification of new questions.
And Google, the one i prefer in design... last time i used it long ago, i
had noticed that the questions were late compared to the MS Web Interface.
And still, need to refresh manually to see new questions. ANd no auto
notification of new questions.

Regards,
Sebastien

"Patrick Molloy" wrote:

indeed
:)

--
Patrick Molloy
Microsoft Excel MVP
---------------------------------
I Feel Great!
---------------------------------
"sebastienm" wrote in message
...
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









All times are GMT +1. The time now is 08:43 AM.

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