CheckBox1_Click()

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

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

Regards
alvin
 
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
 
Link it to a cell. The value in the cell will be True when it is checked
and false when it isn't.
 
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
(e-mail address removed)
 
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
 
Sebastien

Like that one

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Thanks Nick.
Seb

Nick Hodge said:
Sebastien

Like that one

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
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
 
please stay with the thread...otherwise the mail is meaningless

thanks
 
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/c...ming&mid=3171e940-0a32-4872-be06-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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top