Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default check box value

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
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!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default check box value

Thanks for the quick response!

I added:

With Sheets("Sheet1")
..
..
..
End With

But I still get the "Object Required" error. Could it be a library issue?
Any other suggestion would be welcomed.

"Jim Thomlinson" wrote:

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!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default check box value

Which line is it crashing on?. Where is your checkbox. On a form or embedded
in a sheet or...
--
HTH...

Jim Thomlinson


"Romac Rob" wrote:

Thanks for the quick response!

I added:

With Sheets("Sheet1")
.
.
.
End With

But I still get the "Object Required" error. Could it be a library issue?
Any other suggestion would be welcomed.

"Jim Thomlinson" wrote:

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!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default check box value

It's crashing on..
If CheckBox3.Value = True Then

From the forms tool bar I selected "checkbox" and drew it on Sheet1.

I've played with that line, removing the ".Value" and found ways to force a
"True" or "False" condition in the code (always True or always False), but I
can't get that condition to change corresponding to the status of the check
box.

I appreciate your help, I'll probably be checking back on Monday.

"Jim Thomlinson" wrote:

Which line is it crashing on?. Where is your checkbox. On a form or embedded
in a sheet or...
--
HTH...

Jim Thomlinson


"Romac Rob" wrote:

Thanks for the quick response!

I added:

With Sheets("Sheet1")
.
.
.
End With

But I still get the "Object Required" error. Could it be a library issue?
Any other suggestion would be welcomed.

"Jim Thomlinson" wrote:

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!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default check box value

The code that you have (and which I modified) is for a checkbox from the
control toolbox not the forms toolbar. Change the Checkbox and you should be
good to go...
--
HTH...

Jim Thomlinson


"Romac Rob" wrote:

It's crashing on..
If CheckBox3.Value = True Then

From the forms tool bar I selected "checkbox" and drew it on Sheet1.

I've played with that line, removing the ".Value" and found ways to force a
"True" or "False" condition in the code (always True or always False), but I
can't get that condition to change corresponding to the status of the check
box.

I appreciate your help, I'll probably be checking back on Monday.

"Jim Thomlinson" wrote:

Which line is it crashing on?. Where is your checkbox. On a form or embedded
in a sheet or...
--
HTH...

Jim Thomlinson


"Romac Rob" wrote:

Thanks for the quick response!

I added:

With Sheets("Sheet1")
.
.
.
End With

But I still get the "Object Required" error. Could it be a library issue?
Any other suggestion would be welcomed.

"Jim Thomlinson" wrote:

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!

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default check box value

Jim, You are the man!! I did not know there was a difference between the
control toolbox and the forms toolbar. I used the control toolbox checkbox
and it worked.

Thanks for your help!

"Jim Thomlinson" wrote:

The code that you have (and which I modified) is for a checkbox from the
control toolbox not the forms toolbar. Change the Checkbox and you should be
good to go...
--
HTH...

Jim Thomlinson


"Romac Rob" wrote:

It's crashing on..
If CheckBox3.Value = True Then

From the forms tool bar I selected "checkbox" and drew it on Sheet1.

I've played with that line, removing the ".Value" and found ways to force a
"True" or "False" condition in the code (always True or always False), but I
can't get that condition to change corresponding to the status of the check
box.

I appreciate your help, I'll probably be checking back on Monday.

"Jim Thomlinson" wrote:

Which line is it crashing on?. Where is your checkbox. On a form or embedded
in a sheet or...
--
HTH...

Jim Thomlinson


"Romac Rob" wrote:

Thanks for the quick response!

I added:

With Sheets("Sheet1")
.
.
.
End With

But I still get the "Object Required" error. Could it be a library issue?
Any other suggestion would be welcomed.

"Jim Thomlinson" wrote:

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!

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
make a check form, and then have info go to a check register richie g Excel Worksheet Functions 0 May 5th 10 12:10 AM
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
Increase size of a Forms Check Box (click on to enter check mark) 718Satoshi Excel Discussion (Misc queries) 0 August 17th 07 01:52 AM
Check if Conditional Format is True or False / Check cell Color Kevin McCartney Excel Worksheet Functions 5 June 29th 07 11:12 AM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM


All times are GMT +1. The time now is 04:17 PM.

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"