Check box and Value of another cell less than

Rtkinnell

New Member
Joined
May 29, 2019
Messages
11
I am trying to make a Macro stating if a certain cell value is less than 20 AND check box is unchecked then MsgBox.

Here is what I have but cant make it work.

If Range ("G9"). Value <25 AND CheckBox3.Value = False Then
MsgBox "Service Required"
End If
End Sub

The first part of if value of cell work. I however cant get it to work with the checkbox as an and.

Thank you in advance
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Welcome to the Forum!

Try:
Code:
Sub ck()
Dim cb As OLEObject
Set cb = ActiveSheet.OLEObjects("CheckBox3")
If Range("G9").Value < 25 And cb.Object.Value = False Then
MsgBox "Service Required"
End If
End Sub
 
Upvote 0
Welcome to the Forum!

Try:
Code:
Sub ck()
Dim cb As OLEObject
Set cb = ActiveSheet.OLEObjects("CheckBox3")
If Range("G9").Value < 25 And cb.Object.Value = False Then
MsgBox "Service Required"
End If
End Sub

Joe thank you for your quick response. And I apologize for any lack of terminology i may have, I am fairly raw at this. I had actually just finished this step as you responded. I added a cell value to each check box in placed in into code as Range(x). This did the job. My next step is changing message box to yes/no button. If yes checkbox 1 true if no checkbox false. And final step is if box 1 true then box 2 false. I feel confident if I keep looking I can figure it out and im reviewing message box syntax now, but any help and pointers would be appreciated.
 
Upvote 0
Here is where I am at. This is written as am Else if statement repeated. 12 time on 31 different sheets, the variation being the cell range. My code now works as expected and trying to make If yes selected (on MsgBox) then checkbox located at cell link "L9" value to be True(checked) and check box M9 to be false (unchecked) And If MsgBox answer no selected L9 false and M9 True.

If possible on same string I would like to add that both l9 and m9 cannot be selected at the same time.

Any help from anyone would be greatly appreciated.
Code written as follows

Private Sub Worksheet_Calculate ()
If Range("G9").Value < 25 And Range("L9"). Value = False Then
MsgBox "Service Required Main Engine: Refer to OEM Maintenance Plan for Further Detail." & vbNewLine & " select yes to acknowledge service due", VbYesNo

End If
End Sub




Once again it doesnt actually end if there it repeats message as Else if 8 more times
 
Upvote 0

Forum statistics

Threads
1,214,415
Messages
6,119,381
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top