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: 62
Default Warning Message

What im trying to do is make it so when someone doesnt input a value in a
certain field it comes up with a msgbox that tells them to fill it in. Then
when they press Okay on the msgbox it goes back to the form without
submitting it.

So far i have everything except making it so when you click okay on the
message box it goes back to the form without submitting the data or clearing
the form. Also just to make it so the warning message only appears once even
if they dont fill in 2 required fields.

Heres my code:

Private Sub CommandButton1_Click()
Set wks = Worksheets("Trip")

lrA = wks.Cells(Rows.Count, 1).End(xlUp).Row
lrB = wks.Cells(Rows.Count, 2).End(xlUp).Row
lrD = wks.Cells(Rows.Count, 3).End(xlUp).Row
lrE = wks.Cells(Rows.Count, 4).End(xlUp).Row
lrA = wks.Cells(Rows.Count, 5).End(xlUp).Row
lrC = wks.Cells(Rows.Count, 6).End(xlUp).Row

wks.Range("B" & lrA + 1) = ListBox1.Text
wks.Range("F" & lrA + 1) = TextBox1.Text
wks.Range("D" & lrA + 1) = TextBox3.Text
If TextBox3.Text = "" Then
UserForm4.Show
End If

wks.Range("E" & lrA + 1) = TextBox4.Text
If TextBox4.Text = "" Then
UserForm4.Show
End If

wks.Range("A" & lrA + 1) = TextBox5.Text
wks.Range("C" & lrA + 1) = TextBox6.Text
TextBox1.Text = ""
TextBox4.Text = ""
TextBox3.Text = ""
TextBox6.Text = ""

End Sub

Private Sub CommandButton2_Click()
Unload UserForm3
End Sub
 
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
warning message cufc1210 Excel Discussion (Misc queries) 2 September 30th 09 11:48 PM
Warning Message bollard Excel Worksheet Functions 6 September 12th 07 05:59 PM
warning message allan Excel Discussion (Misc queries) 2 March 5th 07 03:20 AM
message box warning M3Cobb[_6_] Excel Programming 2 April 6th 06 11:44 PM
warning message Mike Excel Discussion (Misc queries) 3 March 10th 06 06:20 PM


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

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

About Us

"It's about Microsoft Excel"