Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Save using Macro but test to see if an error appears on spreadshee
I have tests on spreadsheet to see if data is missing and want to save the
spreadsheet using a macro, but first test to see if there is an error message. I am only a basic user of macro's and use them through record. I have found out how to put a message box on screen, but want the box to appear when there is an error, but to save when there are no errors. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Save using Macro but test to see if an error appears on spreadshee
You'll need to create a variable to store an error, I'd suggest a Boolean.
-------- Dim blnError as Boolean blnError = False -------- Then when your code finds an 'error' add this line straight after -------- blnError = True -------- Then at the end of your code, before the save happens, try this -------- If Not blnError then {Enter your line of code which saves the data} Else MsgBox "Error found, workbook not saved!" end if -------- Hope this both makes sense and helps. HTH. "jfaz" wrote: I have tests on spreadsheet to see if data is missing and want to save the spreadsheet using a macro, but first test to see if there is an error message. I am only a basic user of macro's and use them through record. I have found out how to put a message box on screen, but want the box to appear when there is an error, but to save when there are no errors. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using Macro to Save Copy of File to New Location | Excel Discussion (Misc queries) | |||
Macro Save As | Excel Discussion (Misc queries) | |||
Macro to create "path" for save | Excel Discussion (Misc queries) | |||
Save a Macro | Excel Discussion (Misc queries) | |||
How to stop getting the file save box when running a macro | Excel Discussion (Misc queries) |