Skip to Content
avatar image
Former Member

YES no boxes using vba

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

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

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

    EAA.SaveAndRefreshWorksheetData

    Else

    EAA.RefreshActiveSheet

    End If
    Add comment
    10|10000 characters needed characters exceeded