Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get a message pop up when a macro has run? LousieRobinson Excel Discussion (Misc queries) 2 June 17th 09 01:00 PM
A macro disabled message comes up but there is no macro. lovetocount Excel Discussion (Misc queries) 2 June 25th 08 12:54 PM
Macro Pop-Up Message Millie Excel Discussion (Misc queries) 1 July 31st 07 09:52 PM
Message Box Macro Heather O'Malley Excel Discussion (Misc queries) 3 August 22nd 06 09:13 AM
Macro message Alec H Excel Discussion (Misc queries) 4 February 23rd 06 09:39 AM


All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"