Ok, a couple of ways of defining the named ranges.
0. Fixed: ='Retail Report'!$A$7:$H$11
1. Dynamic: Block_AO: ='Retail Report'!$A$7:OFFSET('Retail Report'!$H$12,-1,0)
2. Dynamic: Block_AI: ='Retail Report'!$A$7:INDEX('Retail Report'!$H:$H,MATCH("A Total",'Retail Report'!$A:$A,0)-1)
although the first is shorter, it is volatile so I prefer to avoid it.
and then the code would be modified to:
You need to define a named range for each of the areas that you want to sort. Then use that as in the code example. Just copy the code changing Block_AI to Block_BI, Block_CI, ... etc.
Bit of a pain to set up ... though you can copy and edit the ranges. But, when it's done, the code should be fairly static. If you copy the range from one named range, when you paste it into the new named range, press F2 before you start editing ... makes it easier.
Regards, TMS
Bookmarks