Consulting

Results 1 to 8 of 8

Thread: Delete formulas when unprotect

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Delete formulas when unprotect

    Hi All,
    I've been busy with a project to sort of protect my excell program, to the general user anyway. I have coded that when the sheet has been unptotected by a user that should not be unprotecting, then I delete the formulas in the cells, I was wondering if there is a way to immediately close the workbook on unprotect, instead of them having to change a cell first after unprotecting. In other words as soon as the user unprotects the sheet I would like to close the workbook immediately.
    I have coded so far:-
    Sub SheetIsProtected(oSheet As Worksheet)
    With oSheet.UsedRange
       If oSheet.ProtectContents = False _
       Or oSheet.ProtectDrawingObjects = False _
       Or oSheet.ProtectScenarios = False Then
          UserForm3.Show
          .Value = .Value
          ActiveWorkbook.Save
          Application.Quit
       End If
    End With
    End Sub
    Thanks in advance
    Lee
    Last edited by Aussiebear; 04-08-2023 at 04:24 PM. Reason: Adjusted the code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •