我正在尝试使用 vba 自动化一个 excel 过程。
从 2010 年开始,每个月都有一列(这可以无限延伸,或者至少在 excel 的限制内)。下面有大约 500 行带有数字数据。
所以,我想找到最后一列未使用(当前月份)并从 vlookup 中填充它下面的所有行。
谢谢。
工作代码!
With ActiveSheet.Range("IV42").End(xlToLeft)
Dim iRow As Integer
For iRow = 1 To 581
Dim Lookup_Value, Table_Array, Col_Index, Range_Lookup As String
Lookup_Value = "B42:B622"
Table_Array = "'Current Rankings'!$B$2:$C$607"
Col_Index = "2"
Range_Lookup = "False"
.Offset(iRow - 1, 0).Formula = "=VLOOKUP(" & Lookup_Value & "," & Table_Array & "," & Col_Index & "," & Range_Lookup & ")"
Next iRow
End With