查找最后一列,然后查找该列中的最后一行

我需要find工作表中的最后一列,然后find特定列中的最后一行。 对于最后一列,我使用这个:

lastcol = .Cells(1, .Columns.count).End(xlToLeft).Column last_row = Range((Cells(Rows.count), lastcol).Find("*", after:=r, LookIn:=x1values, lookat:=x1part, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, MatchCase:=False) 

这是工作表的快照:

在这里输入图像说明

有些人也可以帮助我把所有的数据,我想保存在一个数组2维然后粘贴到Excel工作表上的数据?

这里是如何:

 lastcol = .Cells(1, .Columns.Count).End(xlToLeft).Column lastrow = .Cells(.Rows.Count, lastcol).End(xlUp).Row .Cells(lastrow + 1, lastcol).Resize(UBound(myarray)) = myarray 

我们假设批处理数据是从单元格A1开始的Sheet1中的,这里是如何制作二维数组:

 Dim myarray myarray = Sheet1.[a1].CurrentRegion