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: 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



  #4   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



  #5   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



  #8   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





  #9   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

  #10   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





  #11   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




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






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







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 12:02 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"