Blog Archives

Yes / No Msgbox for macro VBA

To put a “yes/no” question before running a macro (with “no” exiting the macro), just put this at the top: Dim strName As String 'InputBox strName = MsgBox("Are you sure?", vbYesNo) 'Exit sub if Cancel button used or no text

Posted in VBA Snippets Tagged with: , , , , , , ,

Gather User Data/Input via an InputBox

There are many times in Excel VBA that we are required to gather information from a user. Probably the most frequent method of doing is via a message box, that is; Sub UserInput() Dim iReply As Integer iReply = MsgBox(Prompt:="Do

Posted in VBA Snippets Tagged with: , , , , , , , ,