Continued from last post
Rem 2
We build up a Main 1D array whose elements are themselves 1 D arrays of the required output rows.
This is done by looping down the target range rows , arTgt() = WsT.Range("C2:C" & LrT & "").Value
At each loop we look for a match of the target range row value in the first column of arrSrch()
We then do the array Split type technique ( https://excelfox.com/forum/showthrea...lication-Index ) to get a 1 D array of the required row. That row is added to the Main 1 D array
We then remove that row from arrSrch() ( using a function from Rick Rothstein https://excelfox.com/forum/showthrea...-Variant-Array ).
Then we move on to the next target range row down
Rem 3
Our output array is a 1D array of 1D arrays , but we noticed that we can treat that in Index as a 2D array https://eileenslounge.com/viewtopic....266691#p266691
For demo purposes, the macro in the next post pastes out the result in a spare worksheet range:
_____ Workbook: SampleSept2020.xlsm ( Using Excel 2007 32 bit )Code:' Example paste out CHANGE Top left cell H35 to suit Let WsT.Range("H35").Resize(UBound(arrOut(), 1) - 1, UBound(arrOut(), 2)).Value = arrOut() ' ** -1 is a bodge to knock off the extra row End Sub
Worksheet: Target
Row\Col H I J 35 H3_1 H4_1 H7_1 36 H3_5 H4_5 H7_5 37 38 H3_2 H4_2 H7_2 39 H3_3 H4_3 H7_3 40 H3_6 H4_6 H7_6 41 H3_8 H4_8 H7_8 42 43 H3_7 H4_7 H7_7
Macro, Sub BrdShlss() , and a couple of required Functions are here:
https://excelfox.com/forum/showthrea...ll=1#post14907




Reply With Quote
Bookmarks