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

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.
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,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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