I am trying to figure out why one code which works in a workbook would not work in another workbook. The only difference is range locations.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Range("a4").Value = "save" Then
Range("a4").Value = ""
Range("H7:AC7").Select
Cancel = False
Else
Cancel = True
MsgBox "Save not allowed. Please use the save button at the bottom of the page.", vbOKOnly
End If
Call AllProtect
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Range("A1").Value = "Save" Then
Range("A1").Value = ""
Range("filename").Select
Cancel = False
Else
Cancel = True
MsgBox "Save not allowed. Please use save button at end of report.", vbOKOnly
End If
Call AllProtect
End Sub
the first code works fine but the second one hangs up when it trys to clear the cell with the password in it.
The only difference is that the word "Save" in the second code is capitalized but that is only because I have a code running that has everything in proper case.
Thanks in advance for your help.
Received Infraction
Bookmarks