|
▼yumi さん:
これもおまけで。
行挿入はいちどだけですからテストの時は注意して下さいね。
Sub TESTa2()
Dim Dic As Object
Dim v1 As Variant
Dim i As Long
Dim v2 As Variant
With Worksheets("データ")
v1 = .Range("A1").CurrentRegion.Resize(, 2).Value
End With
Set Dic = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(v1)
Dic(v1(i, 1)) = v1(i, 2)
Next
With Worksheets("一覧")
' .Rows(2).Insert
v2 = .Range("A1").CurrentRegion.Resize(2).Value
End With
For i = 1 To UBound(v2, 2)
If Dic.Exists(v2(1, i)) Then
v2(2, i) = Dic(v2(1, i))
Debug.Print v2(2, i)
End If
Next
With Worksheets("一覧")
.Range("A1").Resize(2, UBound(v2, 2)).Value = v2
End With
End Sub
|
|