これは接続先Find data in a column from a cell reference in another worksheet then copy some data to another worksheet 特定の月に卒業した場合、クラス名を見つける必要があります。検索の参照に使用される月は別のシートにあります。最初に列Gで卒業月を検索し、検索で何も見つからない場合は次の列で検索します。 これは私がこれまで行ってきたことですが、これは1つの列のみを検索します。私はまだ他の列を検索する方法についてはわかりません。検索は、値が見つかる最初のインスタンスを停止する必要があります。vba列を介してセルデータを検索し、次の列を見ない場合
Sub Hierarchy()
Dim shOUT As Worksheet
Dim nfo As Worksheet
Dim Month As Range
Dim a As Long
Dim thisvalue As String
Set nfo = Worksheets("Info")
Set shOUT = Worksheets("Output")
Set Month = nfo.Range("A2")
With shOUT
' Loop through each row
For a = 2 To 10
thisvalue = .Cells(a, 7).Value
If thisvalue Like Month.Value Then ' <-- check the names
nfo.Range("A5").Value = .Cells(a, 2).Value
nfo.Range("A6").Value = .Cells(1, 7).Value
End If
Next a
End With
End Sub
if文に 'GoTo'を追加するだけです。あなたがそれを使用する方法を知らない場合は、Google GoTo in VBA – Masoud