LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Mandatory cell - display message


If Textbox1.Text = "" Then
Msgbox "TextBox1 empty"
Textbox1.SelLength = Len(TextBox1.Text)
TextBox1.SelStart = 0
TextBox1.setFocus
Exit Sub
ElseIf Textbox2.Text = "" Then
Msgbox "TextBox2 empty"
Textbox2.SelLength = Len(TextBox2.Text)
TextBox2.SelStart = 0
TextBox2.setFocus
Exit Sub
If Textbox3.Text = "" Then
Msgbox "TextBox3 empty"
Textbox3.SelLength = Len(TextBox3.Text)
TextBox3.SelStart = 0
TextBox3.setFocus
Exit Sub
If Textbox4.Text = "" Then
Msgbox "TextBox1 empty"
Textbox4.SelLength = Len(TextBox4.Text)
TextBox4.SelStart = 0
TextBox4.setFocus
Exit Sub
End If

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Hayley" wrote in message
...
I have 2 worksheets. One is a entry page ('form') and the second a storage
for data ('database').

I have written a basic macro which enters the data from the form to the
database. Howerver I would like to add to the macro and get it to check 4
cells which are mandatory. I would like it to exit out of the macro to the
appropriate blank cell and display a message box to enter data. If the 4
cells have data then I would like it to continue the macro and enter data

to
the database sheet.

Could someone please point me to a webpage with an example or explain what
code I need. I have been able to get the message box to come up for the

first
cell but not sure how to then jump to the next mandatory one. Thanks
--
Hayley



 
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
Display error message if a cell is left blank Another Excel User Excel Discussion (Misc queries) 8 February 11th 08 09:02 PM
mandatory cell [email protected] Excel Discussion (Misc queries) 1 January 16th 08 05:28 PM
How do I display a message when a cell has a certain value?? [email protected] Excel Discussion (Misc queries) 4 March 28th 07 04:12 PM
when certain number is typed in a cell to display a message Wanna Learn Excel Discussion (Misc queries) 8 September 18th 06 02:27 PM
How to display a blank cell with no error message Juco Excel Worksheet Functions 11 January 31st 05 08:24 AM


All times are GMT +1. The time now is 01:59 AM.

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"