ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   message box (https://www.excelbanter.com/excel-programming/362563-message-box.html)

tweety127[_7_]

message box
 

hi,
can please send me the proper syntax for message box...my code doesn'
seem to work.
thans

--
tweety12
-----------------------------------------------------------------------
tweety127's Profile: http://www.excelforum.com/member.php...fo&userid=3467
View this thread: http://www.excelforum.com/showthread.php?threadid=54597


RB Smissaert

message box
 
What doesn't work?

Go the VBA help
Type in: msgbox function
Pick the first
All will be explained.

RBS

"tweety127" wrote
in message ...

hi,
can please send me the proper syntax for message box...my code doesn't
seem to work.
thansk


--
tweety127
------------------------------------------------------------------------
tweety127's Profile:
http://www.excelforum.com/member.php...o&userid=34673
View this thread: http://www.excelforum.com/showthread...hreadid=545970



Bob Phillips

message box
 
See help in VBA, it's all explained there.

--
HTH

Bob Phillips

(replace somewhere in email address with googlemail if mailing direct)

"tweety127" wrote
in message ...

hi,
can please send me the proper syntax for message box...my code doesn't
seem to work.
thansk


--
tweety127
------------------------------------------------------------------------
tweety127's Profile:

http://www.excelforum.com/member.php...o&userid=34673
View this thread: http://www.excelforum.com/showthread...hreadid=545970




Kevin B

message box
 

MsgBox Prompt, Command Buttons (Optional), Title Bar (Optional)

MsgBox "You can't get there from here.",vbOKOnly,"Box Title Bar"

You can get a return value for a variable by declaring the variable and
using the MsgBox function:

dim intYesNo as Integer

intYesNo = MsgBox("Want to Continue?,vbYesNo,"Dialog Box Title")

If you don't provide a command button or title bar the OK command button is
used as the default along with the default title bar for the message box
--
Kevin Backmann


"tweety127" wrote:


hi,
can please send me the proper syntax for message box...my code doesn't
seem to work.
thansk


--
tweety127
------------------------------------------------------------------------
tweety127's Profile: http://www.excelforum.com/member.php...o&userid=34673
View this thread: http://www.excelforum.com/showthread...hreadid=545970



tweety127[_8_]

message box
 

here's the code and this is not working.

error message: Expected: =

If Worksheets("sheet5").Range("c6") = " " Then MsgBox("Fill in the
Missing Information!", vbOK, "Warning")

End If
If Worksheets("sheet5").Range("c7") = " " Then MsgBox("Fill in the
Missing Information!", vbOK, "Warning")
End If
If Worksheets("sheet5").Range("c8") = " " Then MsgBox("Fill in the
Missing Information!", vbOK, "Warning")
End If
If Worksheets("sheet5").Range("c9") = " " Then MsgBox("Fill in the
Missing Information!", vbOK, "Warning")
End If


--
tweety127
------------------------------------------------------------------------
tweety127's Profile: http://www.excelforum.com/member.php...o&userid=34673
View this thread: http://www.excelforum.com/showthread...hreadid=545970


RB Smissaert

message box
 
As you are not using the result of the Msgbox function
you have to take the brackets out, so:

MsgBox "Fill in the Missing Information!", vbOK, "warning"
etc.

Didn't your code show up in red?

RBS

"tweety127" wrote
in message ...

here's the code and this is not working.

error message: Expected: =

If Worksheets("sheet5").Range("c6") = " " Then MsgBox("Fill in the
Missing Information!", vbOK, "Warning")

End If
If Worksheets("sheet5").Range("c7") = " " Then MsgBox("Fill in the
Missing Information!", vbOK, "Warning")
End If
If Worksheets("sheet5").Range("c8") = " " Then MsgBox("Fill in the
Missing Information!", vbOK, "Warning")
End If
If Worksheets("sheet5").Range("c9") = " " Then MsgBox("Fill in the
Missing Information!", vbOK, "Warning")
End If


--
tweety127
------------------------------------------------------------------------
tweety127's Profile:
http://www.excelforum.com/member.php...o&userid=34673
View this thread: http://www.excelforum.com/showthread...hreadid=545970



[email protected]

message box
 
Hello,

I think you should delete the parentheses in the MsgBox function as
follows:

If Worksheets("sheet5").Range("c6") = " " Then
MsgBox "Fill in the Missing Information!", vbOK, "Warning"
Worksheets("sheet5").Range("c6").Select 'Added
Exit Sub 'Added
End If

The "Exit Sub" is added to enable the user to complete the information.

I hope this helps.

Regards,


ljsmith[_8_]

message box
 

Try putting this in the Worksheet

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim msg, style, title, response

If Sheet5.Range("c5").Value = "" Or _
Sheet5.Range("c7").Value = "" Or _
Sheet5.Range("c8").Value = "" Or _
Sheet5.Range("c9").Value = "" Then
msg = "Please complete the missing information"
title = "Required Information Missing"
style = vbOKOnly + vbExclamation + vbDefaultButton1 +
vbApplicationModal
response = MsgBox(msg, style, title)
End If

End Sub

End Sub


--
ljsmith


------------------------------------------------------------------------
ljsmith's Profile: http://www.excelforum.com/member.php...o&userid=30531
View this thread: http://www.excelforum.com/showthread...hreadid=545970


tweety127[_9_]

message box
 

You're Such Of Great Help! Thank

--
tweety12
-----------------------------------------------------------------------
tweety127's Profile: http://www.excelforum.com/member.php...fo&userid=3467
View this thread: http://www.excelforum.com/showthread.php?threadid=54597



All times are GMT +1. The time now is 10:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com