Friday, 27 June 2014

Assign Vb Macro (Message Box) msgbox

The MsgBox is a dialog box in Excel VBA we can use to inform the users of your program. There are 5 arguments which we can use with MsgBox function.



 
1) Prompt - This is  required argument where user writes the Text / Warning to display

2) buttons - Optional Argument - User can select Ok/Cancel etc buttons from this argument

3) title - Optional Argument - String Expression displayed in the title bar of message

4)helpfile - Optional Argument - User can attach the help file

5)context - Optional Argument - Require Numeric Expression to assing context in Help file. If context is provided then helpfile must also be provided
 
 
We can achieve above task by following steps

1) Open Excel
2) Select Developer Tab
3) Select Button Under Insert Link (Control Tab)
4) Drag Button on Excel Sheet
5) Right Click on Button
6) Select Assign Macro





MsgBox "Welcome to Learn IT with Sanjay"






Message with Cell Value

MsgBox "Welcome to Learn IT with Sanjay, you have Entered " & Range("I8").Value



New Line Message

MsgBox Range("I8").Value & vbNewLine & Range("I9").Value



See you with next LEARNING

Sanjay
You can contact me  @ mesanjaybakshi@gmail.com for Queries


No comments:

Post a Comment