PDA

View Full Version : Solved: Checking the value of a check box



austenr
08-13-2010, 01:43 PM
Getting an error when I try to run this line.

If Sheets("Input + Wksheet").Range("G6").Value < 65 And Sheets("Input + Wksheet").Range("G7").Value > 65 And Sheets _
("Input + Wksheet").CheckBox85 = True Then

The error is when I add the code for the check box. The error is Doesnt support this property or method.

Bob Phillips
08-13-2010, 01:58 PM
Try



With Sheets("Input + Wksheet")
If .Range("G6").Value < 65 And .Range("G7").Value > 65 And .OLEObjects("CheckBox85").Object Then

MsgBox "Yes"
End If
End With

austenr
08-13-2010, 02:02 PM
Nice!!! Thanks

austenr
08-13-2010, 02:08 PM
This is giving me an End with w/o with error:

With Sheets("Input + Wksheet")
If Sheets("Input + Wksheet").Range("G6").Value < 65 And Sheets("Input + Wksheet").Range("G7").Value > 65 _
And .OLEObjects("CheckBox85").Object Then
With Sheets("Direct Bill Only")
.Range("D12").Value = "X"
.Range("E25").Formula = "=(vlookup(YearsofService, Indemnity, 7, False) + Vlookup(YearsofService, Indemnity, 16, FALSE))/12"
.Range("F25").Formula = "=(Indemnity!h42 + Indemnity!q42)/12-E25"
End With
End With
End If

Bob Phillips
08-13-2010, 02:21 PM
You have the last End With and End If in the wrong order.

austenr
08-16-2010, 06:04 AM
Got the End With and End If situation worked out, now I am getting this error: The checkbox came from the forms toolbox not the controls toolbox. Also should there not be a check to see if it = True of False?

"Unable to get the OLEObjects property of the worksheet class"

If Sheets("Input + Wksheet").Range("G6").Value < 65 And Sheets("Input + Wksheet").Range("G7").Value > 65 _
And .OLEObjects("CheckBox85").Object Then

Bob Phillips
08-16-2010, 09:27 AM
With Sheets("Input + Wksheet")
If .Range("G6").Value < 65 And .Range("G7").Value > 65 _
And .CheckBoxes("Check Box 1").Value Then
With Sheets("Direct Bill Only")
.Range("D12").Value = "X"
.Range("E25").Formula = "=(vlookup(YearsofService, Indemnity, 7, False) + Vlookup(YearsofService, Indemnity, 16, FALSE))/12"
.Range("F25").Formula = "=(Indemnity!h42 + Indemnity!q42)/12-E25"
End With
End If
End With

austenr
08-16-2010, 09:53 AM
That throws a 1004 error, "Unable to get check box property of the worksheet class"

Bob Phillips
08-16-2010, 10:12 AM
Then I am confused. It works fine here, even on a protected sheet.

austenr
08-16-2010, 10:45 AM
Sorry my fault. Check box name , forgot to change it. thanks again.