简体   繁体   中英

Group columns but not protect them and password protect one of the group column

I Have 3 columns a,b,c which I want to group and show as grouped( collapsed section). Column B is locked and when I try to ungroup a,b,c columns it asks me password. I dont want it to ask the password as only column B is password protected not the grouping ungrouping action.

How can I solve this problem in excel/vba

you can add a piece of code to run at beginning and end of your routine. This will un-protect the sheet, run your code, then protect it again.

Begin:

Dim mypassword As String

mypassword = "yourPassword"

ActiveSheet.Unprotect Password:=mypassword

End:

ActiveSheet.Protect Password:=mypassword

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