Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.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
Vba 在Excel中动态选择列的范围_Vba_Excel - Fatal编程技术网

Vba 在Excel中动态选择列的范围

Vba 在Excel中动态选择列的范围,vba,excel,Vba,Excel,我希望工作簿的名称填写在A列中,直到工作表中存在数据的最后一行,我用来查找数据存在的最后一行的代码是 lastRow = ActiveSheet.UsedRange.Row - 1 + ActiveSheet.UsedRange.Rows.Count 第A10列之前的代码存储名称为 Sub testValue() strAddress2 = "A3:A10" wbName = ThisWorkbook.Name Range(strAddress2).Value = Left(wbName

我希望工作簿的名称填写在A列中,直到工作表中存在数据的最后一行,我用来查找数据存在的最后一行的代码是

lastRow = ActiveSheet.UsedRange.Row - 1 + ActiveSheet.UsedRange.Rows.Count
第A10列之前的代码存储名称为

Sub testValue()

strAddress2 = "A3:A10"

wbName = ThisWorkbook.Name

Range(strAddress2).Value = Left(wbName, InStrRev(wbName, ".") - 1)

End Sub
我想用变量“lastRow”中存储的值动态选择范围,但不确定如何进行选择

strAddress2 = "A3:A" & lastRow