Recalc Alarm

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When a recalc is performed, if there is an out-of-balance situation, I want
spreadsheet to alert the user with a msgbox("There is an Out-of-Balance").
How can I do that without having the user do anything besides just recalc the
spreadsheet? The recalc could even be an automatic recalc.
 
There is a calculate event that you can capture. In the sheet that you wnat
to check the balance on add this code (right click the tab and select view
code). You will want to change the range addresses.

Private Sub Worksheet_Calculate()
If Range("A1").Value <> Range("B1").Value Then _
MsgBox "You are out of balance", vbInformation, "Out of Balance"
End Sub
 
That works great. How would I refer to a named range like this:
if reference.namedRange<>0 then _
MsgBox "You are out of balance", vbInformation, "Out of Balance"
 
Found it myself:
Set rng = Range("Gana39GrandTotal")
If Abs(Round(rng, 2)) > 0.01 Then
MsgBox "You are out of balance", vbInformation, "Out of Balance"

I am using the abs of the round of the number to be greater than .01 because
the data is imported and won't exactly equal Zero. This should do it.
Thanks a lot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top