|
VBAを使わなくてもVLookUp関数等を使用した計算式で対応出来そうな
内容ですが、VBAで処理すると、こんな感じで如何でしょうか。
Sub 検索値貼付()
Dim Rng As Range
Dim FRng As Range
Dim Rw As Long
For Rw = 3 To 87 Step 3
Set Rng = Range("B" & Rw)
Set FRng = Range("W138", Range("W65536").End(xlUp)). _
Find(Rng.Value, lookat:=xlWhole)
If Not FRng Is Nothing Then
Rng.Offset(, 5).Value = FRng.Offset(, 1).Value
End If
Next Rw
For Rw = 90 To 93
Set Rng = Range("B" & Rw)
Set FRng = Range("W138", Range("W65536").End(xlUp)). _
Find(Rng.Value, lookat:=xlWhole)
If Not FRng Is Nothing Then
Rng.Offset(, 5).Value = FRng.Offset(, 1).Value
End If
Next Rw
Set Rng = Nothing: Set FRng = Nothing
End Sub
|
|