|
▼G-3 さん:
こんにちは
関数の貼り付けで考えてみました。
Sub tes()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim rngA As Range
Dim rngB As Range
Set sh1 = Sheets("sheet1")
Set sh2 = Sheets("sheet2")
'C列に作業列を追加
Set rngA = sh1.Range("a1", sh1.[a65536].End(xlUp)).Offset(, 2)
With rngA
.Formula = "= a1 & b1"
.Value = .Value
End With
'関数の貼り付け
Set rngB = sh2.Range("A1").CurrentRegion
With Intersect(rngB, rngB.Offset(1, 1))
.Formula = "=COUNTIF(Sheet1!" & rngA.Address & ",$A2&B$1) "
.Value = .Value
End With
'C列の後かたずけ
rngA.ClearContents
Set sh1 = Nothing
Set sh2 = Nothing
Set rngA = Nothing
Set rngB = Nothing
End Sub
|
|