Sub Sample8()
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
UserFormを表示
End Sub
Sub Sample8()
Dim FoundCell As Range, FirstCell As Range
Set FoundCell = Cells.Find(What:="田中")
If FoundCell Is Nothing Then
MsgBox "見つかりません"
Exit Sub
Else
Set FirstCell = FoundCell
UserForm1.ListBox1.AddItem FoundCell.Address & vbTab & FoundCell.Value
End If
Do
Set FoundCell = Cells.FindNext(FoundCell)
If FoundCell.Address = FirstCell.Address Then
Exit Do
Else
UserForm1.ListBox1.AddItem FoundCell.Address & vbTab & FoundCell.Value
End If
Loop
UserFormを表示
End Sub
Sub Sample8()
Dim FoundCell As Range, FirstCell As Range
Set FoundCell = Cells.Find(What:="田中")
If FoundCell Is Nothing Then
MsgBox "見つかりません"
Exit Sub
Else
Set FirstCell = FoundCell
UserForm1.ListBox1.AddItem FoundCell.Address & vbTab & FoundCell.Value
End If
Do
Set FoundCell = Cells.FindNext(FoundCell)
If FoundCell.Address = FirstCell.Address Then
Exit Do
Else
UserForm1.ListBox1.AddItem FoundCell.Address & vbTab & FoundCell.Value
End If
Loop
UserForm1.Show vbModeless
End Sub