Skip to Content
0

YES no boxes using vba

Nov 16, 2016 at 02:16 PM

37

avatar image
Former Member

Hi,

I am trying to write a small piece of VBA to give a a yes / no answer.

So if the user has selected the correct month save the data. If the user has no selected the correct month either do nothing or refresh sheet.

This is the code that i have written.

Function BEFORE_SAVE()

MsgBox "ARE YOU SAVING TO THE CORRECT MONTH", vbYesNo
If answer = vbYes Then
EAA.SaveAndRefreshWorksheetData
End If
If answer = vbNo Then
EAA.RefreshActiveSheet
End If

End Function

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Sep 18, 2017 at 11:06 PM
0

If MsgBox("ARE YOU SAVING TO THE CORRECT MONTH", vbYesNo) = vbYes Then

EAA.SaveAndRefreshWorksheetData

Else

EAA.RefreshActiveSheet

End If
Share
10 |10000 characters needed characters left characters exceeded