Protect Range of Rows and Columns in Worksheet with Macro
Sponsor
Excel Vba Protect Range of Rows and Columns in Worksheet with Macro [Q]
I need help in protecting a range of rows and columns with excel vba macro code in Excel
worksheet. An Excel Workbook contains 14 worksheets (12 for each month, one for yearly total and one for description) More than 2000 employees use it. So I would appreciate if you could help me to do it using excel vba Macro or similar quick method.
Excel Vba Protect Range of Rows and Columns in Worksheet with Macro [A]
We assume you want to protect the same ranges on each of the 14 excel worksheets, so this is the microsoft excel vba macro code:
Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim N As Single
For N = 1 To Sheets.Count
With Sheets(N)
.Cells.Locked = False
.Range(”A1:B14″).Locked = True ‘adjust range to suit
.Protect Password:=”justme”
End With
Next N
Application.ScreenUpdating = True
End Sub
Rate This Tips:
Incoming excel search terms
excel vba protect,excel vba lock range,vba protect range,excel vba lock cell,excel vba protect cells,vba protect column,excel vba protect range,mss,excel macro protect range,vba excel protect,vba excel protect column,vba protect cells,protect range vba,vba excel lock range,vba protect columns,vba protect row,excel lock cells vba,excel vba lock worksheet,excel vba protect columns,how to protect column in excel,range protect vba,vba lock range,vba lock worksheet,vba protect spreadsheet range,vba range locked,excel lock cell with vba,excel vba protect column,excel vba protection,excel vba range,excel vba range locked,excel vba range protect,how to protect a range of cells in excel,how to protect range of cells in excel,lock cells on multiple sheets excel vba,macro protect range,protect cells vba,protect column vba,protect range,protect worksheet vba,range protect,vba column locked,vba excel protect range,vba lock cells,excel protect cells vba,excel range locked vba,excel vba lock cells,excel vba lock column,excel vba lock row,excel vba prevent inserting rows and columns,excel vba protect a row
Related Excel Tips
Comments
One Comment on Protect Range of Rows and Columns in Worksheet with Macro
-
5 Excel Blogs You May Not Have Known About - Code For Excel And Outlook Blog on
Tue, 28th Apr 2009 11:02 am
[...] short code snippets to solve particular problems in Excel using VBA and worksheet formulas. In Protect Range of Rows and Columns in Worksheet with Macro you can grab some sample code that demonstrates how to programmatically lock and protect a [...]
Have another excel answer or questions for this problem ?
Feel free to post it here..














