Just in case it helps - I have had no problems with this macro for more than a year until mysteriously I woke up this morning and boom, it's falling over citing "Run-time error '91': Object Variable or With Block Not Set"(office update perhaps?).
This part of my code looks for today's date in each worksheet and takes the value of the cell next to it to show in a userform (tbProg, tbPlan and tbImp are all textboxes)
For Each Sh In ThisWorkbook.Worksheets
If Sh.Name = "Progress since last meeting" Then
tbProg.Text = Sh.Cells.Find(sNow).Offset(0, 1).Select
tbProg.BackColor = Sh.Cells.Find(sNow).Offset(0, 2).Interior.Color
x = x + 1
End If
If Sh.Name = "Planned before next meeting" Then
tbPlan.Text = Sh.Cells.Find(sNow).Offset(0, 1).Value
x = x + 1
End If
If Sh.Name = "Impediments" Then
tbImp.Text = Sh.Cells.Find(sNow).Offset(0, 1).Value
x = x + 1
End If
Next
The error occurs on the line
tbProg.Text = Sh.Cells.Find(sNow).Offset(0, 1).Select
After a bit of trial and error, everything's groovy until I use
.Offset
or
.Select
or both, or any method at all.
Can anyone help me find a solution to this?
.Value?.Value,.Selectand.Textand all result in the same error.