Private Sub btnFindNow_Click() '开始查找 If Not CheckInput Then Exit Sub '定义变量 Dim wb As Variant Dim sht As Variant Dim sFindStr As String Dim LookatFlag As Integer Dim LookinFlag As Long Dim bMatchCase As Boolean Dim bMatchByte As Boolean '变量赋值 LookatFlag = IIf(chkMatch, xlWhole, xlPart) LookinFlag = VBA.Choose(CombLookIn.ListIndex + 1, xlValues, xlComments, xlFormulas) bMatchCase = chkMatchCase bMatchByte = chkMatchByte sFindStr = txtInput.Value '清除列表 ListView1.ListItems.clear Select Case CombRange.ListIndex Case Is = 0 '当前活动工作表中查找 wb = ActiveWorkbook.Name sht = ActiveSheet.Name Call SearchInSheet(wb, sht, sFindStr, LookinFlag, LookatFlag, bMatchCase, bMatchByte) Case Is = 1 '当前活动工作簿中查找 wb = ActiveWorkbook.Name For Each sht In ActiveWorkbook.Sheets Call SearchInSheet(wb, sht.Name, sFindStr, LookinFlag, LookatFlag, bMatchCase, bMatchByte) Next Case Is = 2 '在所有打开的工作簿中查找 For Each wb In Workbooks For Each sht In wb.Worksheets Call SearchInSheet(wb.Name, sht.Name, sFindStr, LookinFlag, LookatFlag, bMatchCase, bMatchByte) Next Next End Select Call ShowTip txtInput.SetFocus End Sub 具体应改哪个地方呢? |