Code - Protect Sheet

Ben_Holmes

Board Regular
Joined
Mar 30, 2004
Messages
147
Hi How can I work in a protect sheet and password it into the following code?

Sub QUOTE()
'
' QUOTE Macro
' Macro recorded 05/08/2011 by'

'' Turns off screenupdating (Makes screen transition more smooth)
Application.ScreenUpdating = False
Windows("Route.xls").Activate
Cells.Select
Selection.Copy
Workbooks.Add
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Rows("1:1").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
ActiveWindow.Zoom = 75
ActiveWindow.DisplayGridlines = False
Windows("Route.xls").Activate
ActiveSheet.Shapes("Picture 22").Select
Selection.Copy
Range("H2").Select
ActiveSheet.Paste
Range("C5").Select
' Turns screenupdating back on
Application.ScreenUpdating = True
End Sub

Kind Regards

Ben
 
Last edited:

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
It appears as you used the "record macro" feature for most of your code. I would suggest also using it to protect the sheet. If you cant get it to work or still need further help let us know.
 
Upvote 0
assuming that you want to procect the active sheet

Code:
Activesheet.Protect Password:="yourpassword"

on the line before end sub
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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