Sub Sample7()
Dim FoundCell As Range, FirstCell As Range
Set FoundCell = Cells.Find(What:="田中")
If FoundCell Is Nothing Then
MsgBox "見つかりません"
Exit Sub
Else
Set FirstCell = FoundCell
別シートにコピーする
End If
Do
Set FoundCell = Cells.FindNext(FoundCell)
If FoundCell.Address = FirstCell.Address Then
Exit Do
Else
別シートにコピーする
End If
Loop
End Sub
Sub Sample7()
Dim FoundCell As Range, FirstCell As Range
Set FoundCell = Cells.Find(What:="田中")
If FoundCell Is Nothing Then
MsgBox "見つかりません"
Exit Sub
Else
Set FirstCell = FoundCell
別シートにコピーする
End If
Do
Set FoundCell = Cells.FindNext(FoundCell)
If FoundCell.Address = FirstCell.Address Then
Exit Do
Else
別シートにコピーする
End If
Loop
End Sub
とりあえず、コピー元は確定しましたね。
Sub Sample7()
Dim FoundCell As Range, FirstCell As Range
Set FoundCell = Cells.Find(What:="田中")
If FoundCell Is Nothing Then
MsgBox "見つかりません"
Exit Sub
Else
Set FirstCell = FoundCell
FoundCell.Resize(1, 3).Copy コピー先
End If
Do
Set FoundCell = Cells.FindNext(FoundCell)
If FoundCell.Address = FirstCell.Address Then
Exit Do
Else
FoundCell.Resize(1, 3).Copy コピー先
End If
Loop
End Sub
Sub Sample7()
Dim FoundCell As Range, FirstCell As Range
Set FoundCell = Cells.Find(What:="田中")
If FoundCell Is Nothing Then
MsgBox "見つかりません"
Exit Sub
Else
Set FirstCell = FoundCell
FoundCell.Resize(1, 3).Copy Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
Do
Set FoundCell = Cells.FindNext(FoundCell)
If FoundCell.Address = FirstCell.Address Then
Exit Do
Else
FoundCell.Resize(1, 3).Copy Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
Loop
End Sub