Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 尝试执行查找值更改的vlookup_Excel_Vba - Fatal编程技术网

Excel 尝试执行查找值更改的vlookup

Excel 尝试执行查找值更改的vlookup,excel,vba,Excel,Vba,在我的工作簿中,公式可以从E12、E13开始,具体取决于文件中的数据。此外,根据数据,公式可能引用B12或B13。如何使我的公式能够在每周之间更改?您可以使用R1C1格式:.FormulaR1C1=“=Vlookup(RC2,[Ckrun.txt]Ckrun'!C1:C5,5,False)”在公式输入E11但将其更改为变量的地方,我如何设置公式?只需更改范围(“…”)bit使用您想要的任何范围。如何知道公式从哪一行开始?范围(“A”&行数)。结束(xlUp)。偏移量(1,1)。选择是查找值始终位

在我的工作簿中,公式可以从E12、E13开始,具体取决于文件中的数据。此外,根据数据,公式可能引用B12或B13。如何使我的公式能够在每周之间更改?

您可以使用R1C1格式:
.FormulaR1C1=“=Vlookup(RC2,[Ckrun.txt]Ckrun'!C1:C5,5,False)”
在公式输入E11但将其更改为变量的地方,我如何设置公式?只需更改
范围(“…”)
bit使用您想要的任何范围。如何知道公式从哪一行开始?范围(“A”&行数)。结束(xlUp)。偏移量(1,1)。选择是查找值始终位于的位置,因此公式从.Offset(1,4)开始
Sub test
    Dim LR as Long
    LR = Range(“B” & Rows.Count).End(xlUp).row
    Range(“E11:E” & LR).Formula = “=Vlookup(B11,’[Ckrun.txt]Ckrun’!$A$2:$E” & LR & “,5,False)”
End sub