Say I want to create an array of cell values located in multiple 2D location on the same sheet. How do I do that?
For example; loading into one 3D array Range(“A4:F13”), Range(“A20:F29”), Range(“H4:M13”), Range(“H20:M29”)
All the 3D array examples I keep finding utilizing For loops and indexes seem to all start at cell “A1”. I haven’t found something quite like what I’m looking for.
And once I figure this out, is it possible to add a 4th dimension to the array for multiple sheets of the same cell ranges?
Thanks! I’ve been beating my head for days on this now
So far, the only example I’ve found for getting a single 2D range of cells which doesn’t begin at A1 is a dynamic array and created a variable Range such as:
Const LrNum As Integer = 4, LcLetter As String = "A", RrNum As Integer = 10, RcLetter As String = "C"
Dim rg As Range
Set rg = ThisWorkbook.Worksheets("Sheet1").Range(LcLetter & LrNum & ":" & RcLetter & RrNum)
' Create dynamic array
Dim StudentMarks As Variant
' Read values into array from sheet1
StudentMarks = rg.Value
Thomas Devine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.