Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,616
- Office Version
- 365
- 2016
- Platform
- Windows
Is anyone able to shed some light on why I might be getting an "Application-defined or object defined error with the line highlighted in red in the code below?
The odd thing is this had worked flawlessly, but today, it's causing grief. I don't recall changing anything that might have led to this.
The odd thing is this had worked flawlessly, but today, it's causing grief. I don't recall changing anything that might have led to this.
Rich (BB code):
Private Sub Workbook_Open()
'Stop
ini1
svcCnt = 0
svcRid = 0
mbevents = True
'Stop
With ws_front
.Activate
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 1
.Unprotect
With ws_front.Range("J7:BM2206")
.Clear
For Each shp In .Parent.Shapes
If Not Intersect(shp.TopLeftCell, .Cells) Is Nothing Then shp.Delete
Next shp
End With
mbevents = False
.Range("A1") = "Enter Date"
.Range("A2") = Format(0, "00000") 'date serial
.Range("D2") = Format(0, "000") 'record
.Range("E2:F2").Locked = True
.Range("E2") = svcRid
.Range("G2") = svcCnt
.Range("A3:A5") = ""
.Range("A19") = "" 'sunset offset
.Pictures("hidden1").Visible = False
.Pictures("hidden2").Visible = False
.Pictures("hidden3").Visible = False
.Range("P3,R3,Y2,AA2,AG2,AI2,Y3,AA3,Y4,AA4, AG3,AI3") = 0
ws_staff.Range("D4:R33").Clear
ws_lists.Range("D2:D101").Clear
mbevents = True
.Protect
End With
End Sub
When I hover over the line, the error seems to be stemming from "shp.TopLeftCell"
Alias ws_front is recognized as being the proper worksheet.