|
- Sub RngFindNext()
- Dim StrFind As String
- Dim rng As Range
- Dim FindAddress As String
- Dim ResAdd As String
- StrFind = InputBox("请输入要查找的订单号:")
- If Trim(StrFind) <> "" Then
- With Sheet1.Range("B:B")
- .Interior.ColorIndex = 0
- Set rng = .Find(What:=StrFind, _
- After:=.Cells(.Cells.Count), _
- LookIn:=xlValues, _
- LookAt:=xlWhole, _
- SearchOrder:=xlByRows, _
- SearchDirection:=xlNext, _
- MatchCase:=False)
- If Not rng Is Nothing Then
- FindAddress = rng.Address
- Do
- rng.Interior.ColorIndex = 6
- ResAdd = ResAdd & "," & rng.Address
- Set rng = .FindNext(rng)
- Loop While Not rng Is Nothing _
- And rng.Address <> FindAddress
- Range(Mid(ResAdd, 2, 9999)).Select
- End If
- End With
- End If
- End Sub
复制代码 |
|