试运行,会出现91号错误,代码如下On Error GoTo 100
If TxtLh.Text <> "" Then
For i = 6 To 9 '假设有3个表
Ba = "0" & i & "年承认书"
Sheets(Ba).Select
Sheets(Ba).Cells.Find(What:=TxtLh.Text, after:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, MatchByte:=False, SearchFormat:=False).Activate
Exit For
100:
Next i
End If