|
▼馬 さん:
それでは以下で。
Sub Test2()
Dim shA As Worksheet
Dim shB As Worksheet
Dim dic As Object
Dim c As Range
Set shA = Workbooks("ブックA.xlsx").Sheets("Sheet1") '★
Set shB = Workbooks("ブックB.xlsx").Sheets("Sheet1") '★
Set dic = CreateObject("Scripting.Dictionary")
For Each c In shA.Range("A2", shA.Range("A" & Rows.Count).End(xlUp))
dic(c.Value) = c.EntireRow.Range("C1").Value
Next
For Each c In shB.Range("A2", shB.Range("A" & Rows.Count).End(xlUp))
If dic.exists(c.Value) Then c.EntireRow.Range("F1").Value = dic(c.Value)
Next
End Sub
|
|