这是一个通过嵌套if的for循环代码。此代码显示“编译错误:没有If的Else”,但每个Else都有If匹配项。请帮助我找出导致错误的原因!
Sub Clearing()
Dim BR As Excel.Workbook
Dim t As Integer
Dim b As Integer
Dim Found As Range
Dim Cldate As Date
Set BR = Workbooks("BankRec.xlsm")
Cldate = Application.InputBox("Enter the clearing date in MM/DD/YYYY format")
t = BR.Worksheets("aaaa").Cells(1, 1).End(xlDown).Row
b = BR.Worksheets("aaaa").Cells(Rows.Count, 1).End(xlUp).Row
For i = t To b
BR.Worksheets("aaaa").Cells(t + 1, 10).Select
If IsEmpty(BR.Worksheets("aaaa").Cells(t + 1, 10).Value) = True Then
With BR.Worksheets("aaaa").Range(BR.Worksheets("aaaa").Cells(t + 2, 9), BR.Worksheets("aaaa").Cells(b, 9))
Set Found = .Find(what:=BR.Worksheets("aaaa").Cells(t + 1, 9).Value * -1)
If Found.Offset(0, -2).Value = BR.Worksheets("aaaa").Cells(t + 1, 7).Value And Found.Offset(0, 2).Value = BR.Worksheets("aaaa").Cells(t + 1, 11).Value Then
BR.Worksheets("aaaa").Cells(t + 1, 10).Value = Cldate & " " & t
Found.Offset(0, 1).Value = Cldate & " " & t
Else
End If
Else
End If
t = t + 1
Next i
MsgBox "Clearing complete!"
End Sub