Excel VBA 質問スレ Part41©5ch.io
■ このスレッドは過去ログ倉庫に格納されています
0220デフォルトの名無しさん
2016/05/13(金) 21:32:30.68ID:4amCJiHYどっちが使いやすいか自分で判断するといい
Sub macro()
Dim srcRng As Range, fnd As Range
Dim firstAddr As String
Set srcRng = ActiveSheet.UsedRange
Debug.Print "■Findのみ"
Set fnd = srcRng.Find("test", LookAt:=xlWhole, SearchDirection:=xlNext)
If Not (fnd Is Nothing) Then
firstAddr = fnd.Address
Do
Debug.Print fnd.Address
Set fnd = srcRng.Find("test", After:=fnd, LookAt:=xlWhole, SearchDirection:=xlNext)
If (fnd Is Nothing) Then Exit Do
Loop While (fnd.Address <> firstAddr)
End If
Debug.Print "■FindNextあり"
Set fnd = srcRng.Find("test", LookAt:=xlWhole, SearchDirection:=xlNext)
If Not (fnd Is Nothing) Then
firstAddr = fnd.Address
Do
Debug.Print fnd.Address
Set fnd = srcRng.FindNext(After:=fnd)
If (fnd Is Nothing) Then Exit Do
Loop While (fnd.Address <> firstAddr)
End If
End Sub
■ このスレッドは過去ログ倉庫に格納されています