VBA Choice MessageBox

To prompt the user in Excel with a MessageBox, and then to record the user’s choice, use:

Public Function Prompt()

    Dim Choice As VbMsgBoxResult
    
  'Store the message result object
  Choice = MsgBox("Ask the user a question?", vbQuestion + vbYesNo)

    Select Case Choice
        
        Case vbYes
        
    'Return something in the function
    		Prompt = 1
        
        Case vbNo
        
    'Return something in the function
    		Prompt = 0
        
    End Select

End Function
0
Excel VBA Combobox to query and insert Prevent data duplication in Excel VBA

No Comments

No comments yet

Leave a Reply

Your email address will not be published. Required fields are marked *