codeliftsleep
Board Regular
- Joined
- Apr 14, 2017
- Messages
- 103
I've got a dilemma I am faced with. I have a sheet that has GETPIVOTDATA formulas that I have created a BeforeDoubleClick Event that opens a new sheet containing the data reflected in the GETPIVOTDATA via VBA code.
It works without issues when I click the options to allow selection of locked cells when I protect a worksheet in Excel itself. You can't edit it but you can double click it just fine and the code works as it should. However, there is a part of the sheet that needs to update depending on the user who logs in, which means I need to unprotect the sheet, change the data and the re-protect the sheet. When I reprotect it in VBA, the double click ability goes away, saying the cell is locked even as I recorded the macro of me protecting it with the proper options selected in Excel.
Here is the macro it gave me:
When I used this code it still won't allow me to double click the cell as I could before when I did it by hand. How can I get this working properly?
It works without issues when I click the options to allow selection of locked cells when I protect a worksheet in Excel itself. You can't edit it but you can double click it just fine and the code works as it should. However, there is a part of the sheet that needs to update depending on the user who logs in, which means I need to unprotect the sheet, change the data and the re-protect the sheet. When I reprotect it in VBA, the double click ability goes away, saying the cell is locked even as I recorded the macro of me protecting it with the proper options selected in Excel.
Here is the macro it gave me:
Code:
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowUsingPivotTables:=True
When I used this code it still won't allow me to double click the cell as I could before when I did it by hand. How can I get this working properly?