简体   繁体   中英

VBA Excel - Protect column in a sheet based on a cell value

1 1 2 ACT ACT FCST

I have three columns, I would like to run a loop code to check values in 2nd row if it is ACT or FCST. If it is ACT, it will protect the whole column so it will not be updated.

You don't protect columns, you protect sheet. Cells are set as locked or not locked. Then if the sheet protection is activated, locked cells cannot be edited. So to unlock cells to make them editable, you have to unprotect the sheet, set cells as unlocked then protect the sheet.

Use the macro recorder to help you create code. When you develop code that has issue, post it for analysis.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM