wsnyder
Board Regular
- Joined
- Sep 23, 2018
- Messages
- 224
- Office Version
- 365
- Platform
- Windows
Hi all,
Not sure why I am getting the error message
The worksheet is definitely unlocked when I set a breakpoint in the code to check the Unprotect
The cells in the range are not merged.
Other ideas?
Thanks
-w
Not sure why I am getting the error message
Unable to set the Locked property of the Range Class
The worksheet is definitely unlocked when I set a breakpoint in the code to check the Unprotect
The cells in the range are not merged.
Other ideas?
Thanks
-w
VBA Code:
undefined 'Objects
'truncated
Dim rngMessage1 As Range
Dim rngMessage2 As Range
'Initialize Objects
Set wb = ThisWorkbook
Set ws = wb.Worksheets("Model")
ws.Unprotect Password:="stuff"
With ws
Set rngMessage1 = .Range(.Cells(17, 17), .Cells(17, 18))
Set rngMessage2 = .Range(.Cells(18, 17), .Cells(18, 18))
End With
'Clear messages and cell formats
' rngMessage1.UnMerge
' rngMessage2.UnMerge
rngMessage1.Locked = False '<<== Error here
rngMessage2.Locked = False
rngMessage1.ClearContents
rngMessage2.ClearContents
rngMessage1.Font.Italic = False
rngMessage2.Font.Italic = False
rngMessage1.Font.Color = vbBlack
rngMessage2.Font.Color = vbBlack
rngMessage1.Interior.Color = RGB(245, 245, 245)
rngMessage2.Interior.Color = RGB(245, 245, 245)
rngMessage1.Locked = True
rngMessage2.Locked = True
'Truncated
'Tidy up
Set rngMessage1 = Nothing
Set rngMessage2 = Nothing
ws.Protect Password:="stuff"
Set ws = Nothing
Set wb = Nothing
End Sub