Thread: check box value
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default check box value

Other than being a little long winded I don't see anything desperately wrong
but it depends where this code is. Try explicitly referenceing the sheet
something like this...

Private Sub CheckBox3_Click()
with sheets("Shee1")
If CheckBox3.Value = True Then
MsgBox "True", , "checkbox3"
.Range("D5").Value = "check"
.Range("E5").Value = "box"
.Range("F5").Value = "testing"
.Range("D5").Select
Else
MsgBox "False", , "checkbox3"
.Range("D5").Value = ""
.Range("E5").Value = ""
.Range("F5").Value = ""
.Range("D5").Select
End If
end with
End Sub

--
HTH...

Jim Thomlinson


"Romac Rob" wrote:

I'm trying to write an "IF" statement that checks the status of a check box,
then places text in certain cells accordingly (in Excel 2002). ("ELSE" clears
them.)

Private Sub CheckBox3_Click()
If CheckBox3.Value = True Then
MsgBox "True", , "checkbox3"
Range("D5").Select
ActiveCell.FormulaR1C1 = "check"
Range("E5").Select
ActiveCell.FormulaR1C1 = "box"
Range("F5").Select
ActiveCell.FormulaR1C1 = "testing"
Range("D5").Select
Else
MsgBox "False", , "checkbox3"
Range("D5").Select
ActiveCell.FormulaR1C1 = ""
Range("E5").Select
ActiveCell.FormulaR1C1 = ""
Range("F5").Select
ActiveCell.FormulaR1C1 = ""
Range("D5").Select
End If
End Sub

When I click the checkbox I get "Run-time error '424': Object required".
I've reviewed many of the "check box" posts, but can't get the info I need.
Please help!