Sort Worksheets Numerically
How big can those values get?
Up to $ 9,000,000 ? or more?
I would use something like
shName = Space(7)
ValueTxt = CStr(Value)
pos = 7 - Len(ValueTxt) + 1
Mid(shName, pos) =ValueTxt
So shorter values have more spaces in front of the value
and the alphabetical sorting will now work as you want.
Just use enough spaces to fit the highest possible value.
HTH.
Helmut.
"PJFry" schrieb im Newsbeitrag
...
I have workbook with 250 sheets and I need to sort them by the total sales on
each sheet.
My first thought was to rename the sheet to the sales value (e.g. Customer
ABC111 had sales of $4,000, so the worksheet name is now 4000). That part
worked fine, but when I use any sorting code, it sorts the sheets in the
alpha code (1,11,111,2,22,222, ect).
Is there a way to sort these sheets numerically?
Thanks!
PJ
--
Regards,
PJ
Please rate this post using the vote buttons if it was helpful.
|