A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Hi @Fantana, Sean M,
Thank you for your prompt update. I have tested and reproduce the issue you're experiencing on my worksheet.
Before protecting the sheet, make sure you double-check these things:
- Formula cells in column F and H are locked in Format cells > Protection > Locked
- Other cells where users can click are unlocked.
Now you can open VBA and use this script:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Update by Extendoffice
Dim rowRange As Range
Dim colRange As Range
Dim activeCell As Range
ActiveSheet.Unprotect "123" 'replace 123 with your password or use "" if no password
Set activeCell = Target.Cells(1, 1)
Set rowRange = Rows(activeCell.Row)
Set colRange = Columns(activeCell.Column)
Cells.Interior.ColorIndex = xlNone
rowRange.Interior.Color = RGB(248, 150, 171)
ActiveSheet.Protect "123", Contents:=True, Scenarios:=True, UserInterfaceOnly:=False
End Sub
The difference is that using the parameter UserInterfaceOnly. This will allow VBA to modify the sheet when still preventing users from making changes.
Please feel free to reach out again if you have any trouble or need further assistance. I'm happy to help.
Hope to hear from you soon.