msampath
04-05-2016, 07:37 AM
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
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