我正在尝试选择仅包含今天日期的范围,但在 Cells.find(TodayLast).Activate 行上收到运行时错误 91。我无法理解似乎是什么问题。
Sub Escalation()
Dim rng As Range
Dim rngsend As Range
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim strto As String
Dim rngHeader As Range
Dim TodayFirst As Range
Dim TodayLast As Range
Dim LastDate As String
' Finds the area of today's range
LastRow = Sheets("Escal").Range("A65536").End(xlUp).Row
Cells(LastRow, 1).Activate
Set TodayLast = ActiveCell
Cells.find(TodayLast).Activate
Set TodayFirst = ActiveCell
Range(TodayFirst, TodayLast.Offset(0, 6)).Select
'Sorterar breacharna - Sorts the breaches
Selection.Sort Key1:=Range("G1"), Key2:=Range("B1"), Key3:=Range("D1")
'A loop that divides the various comps and enters a GoSub formula that prepares mails
Cells(TodayFirst.Row, 7).Activate
Set CompanyFirst = ActiveCell
Do Until IsEmpty(CompanyFirst)
Cells.find(What:=CompanyFirst, LookIn:=xlValues, SearchDirection:=xlPrevious).Activate
Set CompanyLast = ActiveCell
GoSub PrepareMail
Cells(CompanyLast.Row + 1, 7).Activate
Set CompanyFirst = ActiveCell
Loop
Cells(LastRow, 1).Select
Exit Sub