Hi
I have a 'Reset' button on my Excel worksheet that uses the following VBA:
When I first wrote the above code, the cells that I was clearing did not contain any formulas so it worked fine. However, I have now added some formula to cells D13:D64. It's worth noting that apart from the new formula to cells D13:D64, the worksheet has all the other formula cells within the worksheet locked (I do not have the formula in cells D13:D64 locked because the user still needs to be able to overwrite it).
What I need the Reset button to do now is:
Allow the VBA to turn on a protected worksheet
For Cells D13:D64 - clear the content whilst retaining the formula, set the fill colour to xlNone
For Cells E13:E64 - clear the content and set the fill colour to xlNone
For Cells H1:H2 - clear the contents
Thanks
I have a 'Reset' button on my Excel worksheet that uses the following VBA:
VBA Code:
Sub ResetSPLPlanner()
'
' ResetSPLPlanner Macro
'
'
ActiveSheet.Protect UserInterFaceOnly:=True
Range("D13:E64").Select
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
Range("H1:H2").Select
Selection.ClearContents
End With
Range("A1").Select
End Sub
When I first wrote the above code, the cells that I was clearing did not contain any formulas so it worked fine. However, I have now added some formula to cells D13:D64. It's worth noting that apart from the new formula to cells D13:D64, the worksheet has all the other formula cells within the worksheet locked (I do not have the formula in cells D13:D64 locked because the user still needs to be able to overwrite it).
What I need the Reset button to do now is:
Allow the VBA to turn on a protected worksheet
For Cells D13:D64 - clear the content whilst retaining the formula, set the fill colour to xlNone
For Cells E13:E64 - clear the content and set the fill colour to xlNone
For Cells H1:H2 - clear the contents
Thanks