Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.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_Spreadsheet - Fatal编程技术网

使用VBA滚动到Excel中的最后一行文本

使用VBA滚动到Excel中的最后一行文本,vba,excel,spreadsheet,Vba,Excel,Spreadsheet,有人能告诉我如何让我的电子表格从VBA中移动最后一行文本吗 目前我使用以下代码: Range("p65536").End(xlUp).Select 这是可行的,但它也会移动到特定的列。我想这样做,但保留屏幕上的当前列。尝试以下代码: ActiveSheet.CellsActiveSheet.Rows.Count,Selection.Column.EndxlUp。选择要更改的是ScrollRow。如果您还想水平滚动,可以设置ScrollColumn 谢谢-尝试以下具有行计数的操作似乎不会移动工作

有人能告诉我如何让我的电子表格从VBA中移动最后一行文本吗

目前我使用以下代码:

Range("p65536").End(xlUp).Select
这是可行的,但它也会移动到特定的列。我想这样做,但保留屏幕上的当前列。

尝试以下代码:


ActiveSheet.CellsActiveSheet.Rows.Count,Selection.Column.EndxlUp。选择要更改的是ScrollRow。如果您还想水平滚动,可以设置ScrollColumn


谢谢-尝试以下具有行计数的操作似乎不会移动工作表[ReportingSheet]。CellsfinalRow,Selection.column.EndxlUp.Select
Dim targetSheet As Worksheet
Set targetSheet = ActiveSheet   ' Refer to your sheet instead of ActiveSheet.

targetSheet.Activate    ' Make sure the worksheet is active to prevent errors.

With targetSheet.Cells(targetSheet.Rows.Count, Selection.Column).End(xlUp)
    .Select ' not required to change the focus/view
    ActiveWindow.ScrollRow = .Row
End With