|
Sub Sample2()
Dim x As Long, z As Long, k As Long
Dim c As Range
Dim v() As Variant
Dim tbl As Range
With Worksheets("マスタ")
Set tbl = .Range("A2:B" & .Range("A" & .Rows.Count).End(xlUp).Row)
End With
With Worksheets("レポート")
z = .Range("J" & .Rows.Count).End(xlUp).Row
ReDim v(1 To z, 1 To 1)
For Each c In .Range("J1").Resize(z)
k = k + 1
v(k, 1) = Application.VLookup(c.Value, tbl, 2, False)
Next
.Range("K1").Resize(z).Value = v
End With
Set tbl = Nothing
End Sub
で実行しましたが、アルファベットが含まれるコードは入るのですが、
数字だけのコードが#N/Aのエラー値が返されます。
どうしてでしょうか?
|
|