Message box VBA

DarrenF

Board Regular
Joined
Jun 9, 2014
Messages
90
Hello,

I have created a form in excel and have cells E3, E7 and E19 that are drop downs that need to require information to be selected. E3 has "Select Name", E7 has "Select Reason" and E19 has "Select Yes/No". Can I have a message box that would pop up if any of those boxes have those key words still in them after they press the submit button (button already created)? I also have a text field in E8, if someone tries to submit with it being blank, can I have a message pop up?

Thanks!
Darren
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I believe I've figured it out. However, I would like to have the information corrected before the process for saving happens. What's happening now is the message box will pop, but once you click ok, it will save. I don't want it to be saved until the correct information is selected or input. This is what I have:

Sub Submit_ALL()
Procedure1
Procedure2
Procedure3
Procedure4
Procedure5
Procedure6
Procedure7
End Sub


Sub Procedure1()


If Range("E3").Text = "SELECT NAME" Then
MsgBox ("Please select your name.")
End If

End Sub


Sub Procedure2()


If Range("E7").Text = "SELECT REASON" Then
MsgBox ("Please select the reason for the call.")
End If


End Sub


Sub Procedure3()


If Range("E19").Text = "SELECT YES/NO" Then
MsgBox ("Please select if the call was avoidable.")
End If


End Sub


Sub Procedure4()


If Range("E8").Value <> "0" Then
MsgBox ("Please add a comment about your call.")
End If


End Sub


Sub Procedure5()
Range("K1").Value = Now()
Range("M1").Value = Now()

End Sub


Sub Procedure6()
Dim Dates As String
Dim Time As String
Dim CSTechName As String
Dim CallerName As String
Dim CallerSupervisor As String
Dim CallerPosition As String
Dim ReasonForTheCall As String
Dim StepsTakenToResolve As String
Dim WasTheCallAvoidable As String
Dim EmailCaller As String
Dim EmailCallerLeader As String


Worksheets("Form").Select
Dates = Range("K1")
Worksheets("Form").Select
Time = Range("M1")
Worksheets("Form").Select
CSTechName = Range("E3")
Worksheets("Form").Select
CallerName = Range("E4")
Worksheets("Form").Select
CallerSupervisor = Range("E5")
Worksheets("Form").Select
CallerPosition = Range("E6")
Worksheets("Form").Select
ReasonForTheCall = Range("E7")
Worksheets("Form").Select
StepsTakenToResolve = Range("E8")
Worksheets("Form").Select
WasTheCallAvoidable = Range("E19")
Worksheets("Form").Select
EmailCaller = Range("E20")
Worksheets("Form").Select
EmailCallerLeader = Range("E21")


Workbooks.Open Filename:="H:\CS Tech Support\Call DATA.xlsx"
Worksheets("DATA").Range("A1").Select
RowCount = Worksheets("DATA").Range("A1").CurrentRegion.Rows.Count
With Worksheets("DATA").Range("A1")
.Offset(RowCount, 0) = Dates
.Offset(RowCount, 1) = Time
.Offset(RowCount, 2) = CSTechName
.Offset(RowCount, 3) = CallerName
.Offset(RowCount, 4) = CallerSupervisor
.Offset(RowCount, 5) = CallerPosition
.Offset(RowCount, 6) = ReasonForTheCall
.Offset(RowCount, 7) = StepsTakenToResolve
.Offset(RowCount, 8) = WasTheCallAvoidable
.Offset(RowCount, 9) = EmailCaller
.Offset(RowCount, 10) = EmailCallerLeader
End With
ActiveWorkbook.Save
ActiveWorkbook.Close SaveChanges
Sheets("Form").Select
Range("E3").Select


End Sub


Sub Procedure7()
Worksheets("Form").Range("E4:G4").ClearContents
Worksheets("Form").Range("K5:L6").ClearContents
Worksheets("Form").Range("E7:I7").ClearContents
Worksheets("Form").Range("E8:L18").ClearContents
Worksheets("Form").Range("E19:F19").ClearContents
Worksheets("Form").Range("E20:F20").ClearContents
Worksheets("Form").Range("E21:F21").ClearContents
Worksheets("Form").Range("E7:I7").Value = "SELECT REASON"
Worksheets("Form").Range("E19:F19").Value = "SELECT YES/NO"


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,831
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top