この短いスクリプトは「次へ」で中断します。このデータをコレクションに保存して、ワークブック全体での表示方法をダンプしてカスタマイズできるようにしたいと思います。ご協力いただきありがとうございます
編集:私のコードを更新しました。まだ問題が発生しています。
リソース クラス
''''''''''''''''''''''
' Name property
''''''''''''''''''''''
Public Property Get Name() As String
Name = pName
End Property
Public Property Let Name(Value As String)
pName = Value
End Property
''''''''''''''''''''''
' City property
''''''''''''''''''''''
Public Property Get City() As String
City = pCity
End Property
Public Property Let City(Value As String)
pCity = Value
End Property
''''''''''''''''''''''
' Title property
''''''''''''''''''''''
Public Property Get Title() As String
Title = pTitle
End Property
Public Property Let Title(Value As String)
pTitle = Value
End Property
スクリプト
Sub searchResources()
Dim a As Range
Dim cell As Variant
Dim Resources As Collection
Dim Emp As Resource
Dim Count As Integer
For Each cell In a.Rows
If cell.Value = "Dallas" Or cell.Value = "Oklahoma City" Or cell.Value = "Houston" Then
Set Emp = New Resource
Emp.City = cell.Value
cell.Offset(0, -2).Select
Emp.Title = cell.Value
cell.Offset(0, -1).Select
Emp.Name = cell.Value
Resources.Add Emp
End If
Resume Next
For Each Emp In Resources
ActiveWorkbook.Sheets("A").Activate
a.Select
Debug.Print Emp.Name
Debug.Print Emp.City
Debug.Print Emp.Title
Next Emp
End Sub