- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
¦^´_ 3# chengtoo
¨S·j´M¥Xµ²ªG ·|¤@ª½¥X²{¿ù»~¦b ³Ì«á±ªº End If °õ¦æ«á¨S³o¿ù»~
¸Õ¸Õ¬Ý קï¬O§A©Ò»Ý¶Ü?- Sub QuickSearch()
- Dim wks As Excel.Worksheet
- Dim rCell As Excel.Range
- Dim szLookupVal As String
- szLookupVal = InputBox("key in", "key in msg", "")
- If szLookupVal = "" Then Exit Sub
- Application.ScreenUpdating = False
- 'Application.DisplayAlerts = False
- On Error GoTo Sheet_add 'µ{¦¡½X¦³¿ù»~:GoTo(¨ì) Sheet_add Ä~Äò°õ¦æµ{¦¡½X
- With Sheets("Result").Cells '¤u§@ªí¤£¦s¦b·|¦³¿ù»~
- .Clear
- .Cells(1) = "¤U±¤]¦³©Ò»Ýn¸ê°T" & szLookupVal
- .EntireColumn.AutoFit
- .HorizontalAlignment = xlCenter
- End With
- On Error GoTo 0 'µ{¦¡½X¦³¿ù»~:¤£³B¸Ì->¹w¨¾¦³¤£ª¾ªº¿ù»~¥i¦A×¥¿µ{¦¡½X
- i = 2
- For Each wks In ActiveWorkbook.Worksheets
- If wks.Name = "Result" Then Exit For
- With wks.Cells
- Set rCell = .Find(szLookupVal, , , xlWhole, xlByColumns, xlNext, False)
- If Not rCell Is Nothing Then
- szFirst = rCell.Address
- Do
- With Sheets("Result")
- .Cells(i, 1) = wks.Name & "'!" & rCell.Address
- .Cells(i, 2) = rCell
- End With
- rCell.Interior.ColorIndex = 19
- Set rCell = .FindNext(rCell)
- i = i + 1
- Loop While Not rCell Is Nothing And rCell.Address <> szFirst
- End If
- End With
- Next wks
- Set rCell = Nothing
- Sheets("Result").Activate
- If i = 2 Then MsgBox "©Òn¬d§äªºÈ{" & szLookupVal & "}¦b¤u§@ªí¤¤¨S¦³", 64, "§ä¤£¨ì³á"
- Application.ScreenUpdating = True
- ' Application.DisplayAlerts = True
- Exit Sub 'Â÷¶}µ{§Ç-> ¤£¦A°õ¦æ Sheet_add:¤Uªºµ{¦¡½X
- Sheet_add: 'Result¤£¦s¦b®É·s¼W¤u§@ªí
- Sheets.Add ActiveSheet
- ActiveSheet.Name = "Result"
- Resume '¦^¨ìµ{¦¡½X¿ù»~¦æÄ~Äò°õ¦æµ{¦¡
- End Sub
½Æ»s¥N½X |
|