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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
10,577
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.
 

Forum statistics

Threads
1,136,970
Messages
5,678,895
Members
419,788
Latest member
Mukund2903

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
Top