Results 1 to 5 of 5

Thread: Error with Protect and Unprotect through VBA

Threaded View

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

    Error with Protect and Unprotect through VBA

    Hello all,


    I have an error while protect and unprotect through vba where some options are missing while mouse right click.When you protect without vba for four columns its fine but when protect using vba the options delete,paste,insert copied cells are missing .Please help me.

    Please find the attachments one with Excel VBA and other by selecting protect and unprotect in excel manually.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        ActiveSheet.Unprotect
        ActiveSheet.Protect _
        DrawingObjects:=False, _
        Contents:=True, _
        Scenarios:=True, _
        UserInterfaceOnly:=True, _
        AllowFormattingCells:=True, _
        AllowFormattingColumns:=True, _
        AllowFormattingRows:=True, _
        AllowInsertingColumns:=True
    End Sub
    Thanks & regards
    Sampath
    Attached Images Attached Images
    Last edited by Aussiebear; 03-04-2025 at 02:13 PM.

Posting Permissions

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