How to Protect Sheet from editing in Multiple Workbooks at once?

VinodKrishnappa

New Member
Joined
Aug 6, 2016
Messages
31
Hi,

I would like to protect a particular sheet from editing in various work book files available in particular folder.

In the sheet i need to enable editing option only particular cells which. Rest all i want to protect

For Ex:
File Name: workbook1.xlsx
Sheet Name: sheet1

In a folder i have multiple workbooks like "workbook1.xlsx", "workbook2.xlsx" and so on... In each work book i want to protect sheet1 from editing/formatting/ except few cells which are unlocked.

Please help me on this. Thanks in advance.

Regards,
VK
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Try the following macro:
Code:
 Sub ProtectSheet()
    Application.ScreenUpdating = False
    Dim wkbSource As Workbook
    Const strPath As String = "C:\Test\" 'change folder path to suit your needs
    ChDir strPath
    strExtension = Dir("*.xlsx")
    Do While strExtension <> ""
        Set wkbSource = Workbooks.Open(strPath & strExtension)
        With wkbSource
            .Sheets("Sheet1").Protect Password:="mypassword" 'change "mypassword" to suit your needs
            .Close savechanges:=True
        End With
        strExtension = Dir
    Loop
    Application.ScreenUpdating = True
End Sub
Change the folder path to match yours and change the password to one of your choosing.
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,217
Members
449,074
Latest member
cancansova

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