Hello,
I’m attempting to grasp the concepts of working with arrays.
- Is it possible to loop through a series of worksheets containing the same types of data
- Select all the data on each sheet
- Declare the data as a range dynamically ( if this is necessary)
- Load that range into an array (nRows, 5Col)
- And then perform actions based upon items in that array?
Sub TestArray()
Dim SheetData As Variant
Dim lngRow As Long
Dim lngCol As Long
Dim SrcRng As Range
SheetData = ThisWorkbook.Names("SrcRng").RefersToRange
For lngRow = LBound(SheetData) To UBound(SheetData)
For lngCol = LBound(SheetData, 2) To UBound(SheetData, 2)
Debug.Print "Item ("; lngRow; ","; lngCol; ")", SheetData(lngRow, lngCol)
Next
Next
Debug.Print
End Sub
I’ve attached a workbook with sample data and the code that I’ve managed to cobble together at this point.
It doesn't loop through the worksheets nor dynamically create the data ranges.
Thanks for your assistance.
Mark
Bookmarks