LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sorry about the last ones...And statements with IF's

I am trying to put a function into this user box so that if one of th
textboxes are empty, then nothing gets entered into the sheet. Ca
anyone help? I am stumped. I greatly appreciate it.

Private Sub OK_Click()

'This all happens when OK is clicked.

'if the first textbox is blank, then a message box pops up
'to tell you a value must be entered.

If TextBox1 = "" Then MsgBox "you must enter a name"
Range("a1") = TextBox1.Value


If TextBox2 = "" Then MsgBox "you must enter an age"
Range("a2") = TextBox2.Value


If TextBox3 = "" Then MsgBox "you must enter a gender"
Range("a3") = TextBox3.Value


'clears the text boxes for next use
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""

'sets the cursor in textbox1
TextBox1.SetFocus


'hides the userform when ok is clicked
Me.Hide

End Su

--
Message posted from http://www.ExcelForum.com

 
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
Sum with 2 if's Nadine Excel Worksheet Functions 1 May 6th 10 10:08 PM
Or's with If's Statements Sr Accountant[_2_] Excel Discussion (Misc queries) 6 June 22nd 07 03:18 PM
Too many 'if's! Ben Mehling Excel Discussion (Misc queries) 4 May 11th 07 01:31 PM
Too Many If's Rianne Excel Worksheet Functions 10 March 22nd 07 08:13 PM
IF's karensa Excel Worksheet Functions 4 December 27th 06 10:05 PM


All times are GMT +1. The time now is 05:52 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"