![]() |
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. |
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. |
All times are GMT +1. The time now is 12:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com