ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,232
- Office Version
- 2007
- Platform
- Windows
Hi,
I have the code as shown below.
Currently when the MsgBox opens & i see "CONTINUE TO OPEN POSTAGE FORM", vbInformation + vbYesNo + vbDefaultButton2, "OVERIDE POSTAGE USERFORM")"
The NO button is selected as default.
How can i make the YES the default button.
Thanks
I have the code as shown below.
Currently when the MsgBox opens & i see "CONTINUE TO OPEN POSTAGE FORM", vbInformation + vbYesNo + vbDefaultButton2, "OVERIDE POSTAGE USERFORM")"
The NO button is selected as default.
How can i make the YES the default button.
Thanks
Rich (BB code):
Private Sub Worksheet_Activate()
Application.Goto Sheets("POSTAGE").Range("A" & Rows.Count).End(xlUp).Offset(0, 0), True
ActiveWindow.SmallScroll UP:=15
Dim answer As Integer
answer = MsgBox("DO YOU WISH TO OPEN THE POSTAGE FORM", vbQuestion + vbYesNo + vbDefaultButton2, "POSTAGE OPEN USERFORM MESSAGE")
If answer = vbNo Then
Exit Sub
Else
Dim ws As Worksheet, lRow As Long, i As Long
Set ws = Application.Worksheets("POSTAGE")
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Row ' count total rows using A col
For i = 8 To lRow ' <-- change number rows to check here
If ws.Range("G" & i).Value = "POSTED" Then
PostageTransferSheet.Show
Exit Sub
End If
Next i
MsgBox "NO NAMES TO SHOW AS ALL PARCELS HAVE NOW BEEN DELIVERED", vbInformation, "POSTAGE DATE TRANSFER SHEET MESSAGE"
answer = MsgBox("CONTINUE TO OPEN POSTAGE FORM", vbInformation + vbYesNo + vbDefaultButton2, "OVERIDE POSTAGE USERFORM")
If answer = vbYes Then
PostageTransferSheet.Show
Else
Exit Sub
End If
End If
End Sub