Office中国论坛/Access中国论坛
标题:
查找到后不会跳到要查找的指定位置?
[打印本页]
作者:
小竹长成树
时间:
2016-9-6 10:52
标题:
查找到后不会跳到要查找的指定位置?
请教老师:查找订单号时查找到后不会跳到要查找的指定位置?烦请老师给予帮助改进。谢谢!
作者:
pureshadow
时间:
2016-9-6 16:56
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
复制代码
作者:
小竹长成树
时间:
2016-9-7 08:30
谢谢老师!
作者:
roych
时间:
2016-9-7 17:04
还以为这是一个新人,结果发现伦家注册时间比我还早
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3