5 Different Ways to Find The Last Row or Last Column Using VBA
'開啟 excel file
Set myxlapp = CreateObject("excel.application")
myxlapp.workbooks.Open my_excel
With myxlapp.Sheets(1)
excel_rows = .UsedRange.Rows.Count
excel_columns = .UsedRange.Columns.Count
MsgBox excel_rows & ", " & excel_columns
End With