ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cancel to take focus (https://www.excelbanter.com/excel-programming/320914-cancel-take-focus.html)

Pat

Cancel to take focus
 
With the following example messagebox the Ok button by default takes the
focus. What do I need to add to allow the Cancel button to take the focus?

If IsEmpty(Cells(22, 11)) Then
MsgBox "Cancel has the focus"
Exit Sub
End If

Thank you if you can help out.
Pat



RB Smissaert

Cancel to take focus
 
MsgBox "Cancel has the focus", vbOKCancel + vbDefaultButton2, ""

RBS


"Pat" wrote in message
...
With the following example messagebox the Ok button by default takes the
focus. What do I need to add to allow the Cancel button to take the focus?

If IsEmpty(Cells(22, 11)) Then
MsgBox "Cancel has the focus"
Exit Sub
End If

Thank you if you can help out.
Pat





All times are GMT +1. The time now is 01:57 AM.

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