Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default CheckBox1_Click()

Hi

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

Regards
alvin

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

  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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



All times are GMT +1. The time now is 03:33 AM.

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"