Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 -- HTH... Jim Thomlinson "Mike H." wrote: 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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
If Range("name").Value < 0 Then _ In article , Mike H. wrote: 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" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Alarm | Excel Worksheet Functions | |||
FLASH ALARM | Excel Discussion (Misc queries) | |||
Alarm | Excel Programming | |||
Schedule Alarm | Excel Discussion (Misc queries) | |||
Timer Alarm | Excel Programming |