Code Problem in BeforeSave Event

G

Guest

I've got this code in the BeforeSave event of my workbook:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

If MsgBox("Have you researched and manually entered the correct" _
& vbNewLine & "amounts for Proceeds from" _
& " Sale of PPE?", vbYesNo, "Reminder") = vbYes Then
ActiveWorkbbook.Save
Else
Sheets("Cash Flow").Select Range("B25").Select

End If
End Sub

When I get my MsgBox and click YES, I get a run time error and the code
stops on the ActiveWorkbook.Save line.
If I click NO, the workbook saves, despite the fact I only want to go to a
specific cell. How do I fix this code so when I click TES the workbook
saves, and when I click NO it goes to the specified cell?
 
G

Guest

Now the NO button works fine, but the YES button still bombs out on the
ActiveWorkbook.Save line.
 
S

Steve

Since this is on a 'Before Save' event, you don't need the Active
Workbook.Save line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top