Protect the sheet from move or copy

Useful

Active Member
Joined
Mar 16, 2011
Messages
494
Hi mr excel!
This time i want to ask a question about how to disble the sheet from "move or copy" and also dragging with help left click of mouse to creat copy?
I find this two codes below:

I-First code; this code protects to insert new sheet with "Shift+F11" and From the menu bar "Insert worksheet"
Code:
Private Sub Workbook_NewSheet(ByVal Sh As Object)
With Application
    .DisplayAlerts = False
    .ScreenUpdating = False
End With
Sh.Delete
With Application
    .DisplayAlerts = True
    .ScreenUpdating = True
End With
MsgBox "You can't to insert new worksheet"
Application.CommandBars("Ply").FindControl(, 945).Enabled = False
End Sub
II. Second code; helps to disable the tab menu bar (on right click).
also hides menu bar

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Worksheet Menu Bar").Enabled = True
Application.CommandBars("Sheet").Enabled = False
Application.CommandBars("Ply").Enabled = False
End Sub

But still i have problem -that users can creat new sheets with "Ctrl+left click on mouse then dragging and new sheet already created
Now i want to disable all of possibility to creating a new sheets
have any idea?
Thanks in advance!
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
You can protect the workbook..

Tools - Protection - Protect Workbook - Structure.

(this is different from Sheet protection, it's Protect - Workbook)


Hope that helps.
 
Upvote 0
You can protect the workbook..

Tools - Protection - Protect Workbook - Structure.

(this is different from Sheet protection, it's Protect - Workbook)


Hope that helps.

Jonmo 1 Thank for your answer it works
(i thing that why i could'nt to thing do this action before that is simple way indeed)
Thanks a lot!
 
Upvote 0
Glad to help !

Hi Jonmo1! thanks for your advice but after using the VBA codes that posted above I have a problem when by clicking right button of mouse on the cells- menu not appearing and also when clicking on the sheet tab-Insert isn't active I've removed all this codes but still I've problem with appearing active full menu by right cliking
Thanks in advance!
 
Upvote 0
You probably need to reverse the changes it made...

Run this

Code:
sub test()
Application.CommandBars("Worksheet Menu Bar").Enabled = True
Application.CommandBars("Sheet").Enabled =True
Application.CommandBars("Ply").Enabled = True
end sub
 
Upvote 0
You probably need to reverse the changes it made...

Run this

Code:
sub test()
Application.CommandBars("Worksheet Menu Bar").Enabled = True
Application.CommandBars("Sheet").Enabled =True
Application.CommandBars("Ply").Enabled = True
end sub

jonmo1 thanks for your answer i tried this way too but there is no positive result. "Insert" isn't active on sheet tab yet
have you any other idea?
 
Upvote 0
( Finally the thread is closed) The problem is solved with this code

Application.Commandbars("Ply").Reset</pre>
 
Upvote 0

Forum statistics

Threads
1,224,526
Messages
6,179,322
Members
452,906
Latest member
Belthazar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top