We help IT Professionals succeed at work.

How can I exclude a range of cells from having the MsgBox warning pop-up

gdunn59
gdunn59 asked
on
53 Views
Last Modified: 2016-03-04
I have the following vba code in excel that pops up a warning msgbox if a user tries to enter data in these 2 cells (Columns L & M) and there is nothing populated in another Column.  The problem is the msgbox should only pop up if the user is selecting one of the 2 columns (L & M) starting on Row 8 and below.

Code:
If Target.CountLarge > 1 Then Exit Sub

If Target.Column = 12 Or Target.Column = 13 And Target.Row > 7 Then
   If Cells(Target.Row, "F") = "" Then
      MsgBox "You cannot update SubmittedDate or Comments2 because this Invoice has not had an eBill file generated yet.", vbExclamation, "InvElecHistoryID Missing!"
'      Cells(Target.Row, "F").Select
   End If
End If

Open in new window


How does the code need to be changed to adapt to this?

Thanks,

gdunn59
Comment
Watch Question

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Doug,

That's what I have other than I don't have the parenthesis.  That makes a difference?

Thanks,

gdunn59

Author

Commented:
Doug,

I tried your solution and it did work.  Wow I did not know that by just adding the parenthesis that it would work, and that it was such a simple fix.

Thanks much,

gdunn59

Commented:
Yes.  The parens result in a single TRUE or FALSE for the check on the column and that, coupled with the check on the row should give you the result that you're looking for.

Commented:
Happy to help.

Author

Commented:
Worked like a charm.  Thanks!!!!!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.