I am running through about 500 iterations of the same type of procedure and I run into this error on the 227th iteration. I'm not sure why it works for all of the items before hand or why it stops working here. The generalized code looks like this:
sub macro()
Set ws = ThisWorkbook.Sheets("Sheet1")
for i = 1 to 500
datarange1 = "f3:f50"
Set range1 = ws.Range(datarange1)
lupValue= Application.WorksheetFunction.Min(range1)
With range1
Set cellc = .Find(lupValue, LookIn:=xlValues)
date_min = cellc.Offset(0, -4).Value
End With
next
end sub
The code stops on the 'date_min = cellc.Offset(0, -4).Value' with the 'object variable error'
Any idea why it stops?