參考資料1:https://blog.gtwang.org/programming/excel-vba-array/
參考資料2:https://learn.microsoft.com/zh-tw/previous-versions/office/troubleshoot/office-developer/select-cells-rangs-with-visual-basic
以下不是最好的答案。
因為還要顧你的中間空白,跟其它例外狀況。
Dim i As Integer
Dim myTable As Variant
'取最後一列
lastCol = ActiveSheet.Range("a1").End(xlToRight).Column
'取最後一行
lastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, lastCol).End(xlUp).Row
'用Range抓座標取陣列
myTable = ActiveSheet.Range("a1", ActiveSheet.Cells(lastRow, lastCol)).Value
Dim myRng as Range
Set myRng = Range("A1").CurrentRegion
https://learn.microsoft.com/zh-tw/office/vba/api/excel.range.currentregion