At least on checkbox checked

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:15 PM GMT

Question

Sorry Tom. It is still not working as intended. Now I am getting a Compile Error: End If without block If. I tried each of the following with unsatisfactory results: -removed the last End IF -broke up each Then statement (2 lines) -broke up both Then statements and added an End If -broke up both Then statements and added an End If after the pages of code. Sorry for starting a new post. I ran out of follow ups. I hope that doesn't mean I should figure it out on my own because I would be lost without your help.

Answer

Ian,

Little hard to debug from afar - I did screw that up. I modified your code and it had

if checkboxs = False

I changed that to if Not bChecked = False

I had intended to remove the =False but failed to do so

So my last answer didn't detect the true error and was flawed.

this is tested and worked:

Sub ValidateSituation() Dim bChecked As Boolean Dim chk As CheckBox For Each chk In ActiveSheet.CheckBoxes

If chk.Value = xlOn Then
  bChecked = True
  Exit For
End If

Next If Range("K19") = "" Or Not bChecked Then If Range("K19") = "" Then MsgBox "Please enter an Est. End Of Job Date (K19) even if it is just a wild guess" If Not bChecked Then MsgBox "Please check at least one box" Exit Sub End If ' just for test puposes MsgBox "Now Processing Pages of Code" ' pages of code End Sub

Sorry for the misdirection/errors.

Advertisement

©2017 eLuminary LLC. All rights reserved.