Hi all have the following code
Sub SaveSheetToExResidents()
Dim ws As Worksheet
Set ws = ActiveSheet
ws.Unprotect Password:="debra"
ws.Range("A1:O76").ExportAsFixedFormat xlTypePDF, Filename:= _
"C:\Users\Tonyg\Desktop\Altair Tony\Ex Residents\" & ws.Range("F76").Value & ws.Range("D76") & ws.Range("C76").Value, Openafterpublish:=False
ws.Range("D7:G10").ClearContents
ws.Range("I8:L10").ClearContents
ws.Range("K14:N16").ClearContents
ws.Range("H19:M24").ClearContents
ws.Range("C13:I16").ClearContents
ws.Range("C19:F23").ClearContents
ws.Range("C26:I26").ClearContents
ws.Range("C34:K37").ClearContents
ws.Range("C44:L66").ClearContents
ws.Range("E69:I74").ClearContents
ws.Range("C29:K31").ClearContents
ws.Protect Password:="debra", UserInterfaceOnly:=True
ws.Range("C76").Value = ws.Range("C76").Value Mod 99 + 1
Sheet196.Protect Password:="debra", UserInterfaceOnly:=True
Sheet196.Activate
End Sub
If i use F8 the above works fine, it saves to desired folder and finally returns to sheet requested. However when I run the macro, it only returns to final sheet. It doesn't save to folder or clear contents from worksheet.
What am i doing wrong?