![]() |
Message Box in a macro
I want to verify that certain cells aren't blank before continuing to run a
macro. ie: if the name field is left blank, the macro would stop and a message box would pop up saying "A name must be entered" Once a message box pops up and OK button is chosen, the macro would stop/reset and the user would have to start the macro over again after filling in the name field. A number of fields would be checked prior to continuing on with the macro. Thank you very much. |
Message Box in a macro
Hi Modell
Try this: Assuming you used named ranges: Sub myMacro If IsEmpty(Range("Name") then Range("Name").Select MsgBox "A name must be entered", vbOkOnly, "Form not completed" Exit Sub End If If IsEmpty(Range("ZIP") then Range("ZIP").Select MsgBox "A zipcode must be entered", vbOkOnly, "Form not completed" Exit Sub End If End Sub HTH, Executor. |
All times are GMT +1. The time now is 12:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com