ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Locking Cells from list (https://www.excelbanter.com/excel-programming/364163-locking-cells-list.html)

Kurt Barr

Locking Cells from list
 
I have a list of cell addresses that I would like to build a macro for to
lock the cell when protection is enabled. The number of addresses that I have
is very large, so I don't want to have to key in each address by hand. Can
someone help me build a macro that will do this?

Tom Ogilvy

Locking Cells from list
 
by default, all cells are locked, so I assume you want to unlock all others

Activesheet.Unprotect Password:="ABC"
Cells.Locked = False
Range("A1,B9,C3:C5,F2,R32:Z29,M2,M5,M8").Locked = True
Range("Z1,AB9,AC3:AC5,BF2,BR32:BZ29,AM2,AM5,AM8"). Locked = True
Activesheet.Protect Password:="ABC"


--
Regards,
Tom Ogilvy


"Kurt Barr" wrote:

I have a list of cell addresses that I would like to build a macro for to
lock the cell when protection is enabled. The number of addresses that I have
is very large, so I don't want to have to key in each address by hand. Can
someone help me build a macro that will do this?



All times are GMT +1. The time now is 06:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com