VBA Save table in array

Published: 30 June 2021
on channel: Simplified Excellence
405
4

Save a range in an array.

Code:
Sub save_table_in_Array()

Dim ws_sheet As Worksheet
Dim lastrow As Long
Dim lastcolumn As Long
Dim array_data() As Variant

'identify worksheet
Set ws_sheet = Worksheets(2)

'find table's limits
lastrow = ws_sheet.Cells(Rows.Count, 1).End(xlUp).Row
lastcolumn = ws_sheet.Cells(1, Columns.Count).End(xlToLeft).Column

'save table in array
array_data = ws_sheet.Range(ws_sheet.Cells(1, 1), ws_sheet.Cells(lastrow, lastcolumn))

End Sub

-------------------------------
NEED HELP?
-------------------------------
Leave a comment with your questions, issues or projetcs and I will try to answer with a video.

-------------------------------
THANK YOU
-------------------------------
For watching my videos,
Your shares
And your comments!


On this page of the site you can watch the video online VBA Save table in array with a duration of hours minute second in good quality, which was uploaded by the user Simplified Excellence 30 June 2021, share the link with friends and acquaintances, this video has already been watched 405 times on youtube and it was liked by 4 viewers. Enjoy your viewing!