简体   繁体   中英

VBA Excel - How to enable editing format in a range in a protected sheet

I want to have a protected sheet while not allowing to select locked cells (only range that I want to format) while allowing a change of format of range("B22:M46"). Only the format

In other words, there will be a range where you can change only format of cells and all the other cells will be locked and user will not be able to select these cells.

I know how to protect sheet, how to unlock range and even how to enable selection, but I can't put it all together

Is this even possible? Thank you

A quick look at the interface, using the recorder gave me an answer:

With mySheet
    .Protect ...., AllowFormattingCells:=True
    .EnableSelection = xlUnlockedCells
End With

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