excel - vba sort worksheets: why capital / non-capital? -
i have code sorts worksheets sheet 9 until last sheet. found works perfectly. thing not understand: code somehow sorts capitals first , after that, sheets names not start capitals follow. why that?
this sort code:
sub sortsheets() application.screenupdating = false dim integer, j integer = 9 sheets.count j = + 1 sheets.count if sheets(j).name < sheets(i).name worksheets(j).move before:=worksheets(i) end if next j next end sub
it sorts right worksheets first, worksheets name starts capital sorted, , after that, sheets names start non-capital sorted.
while code provided simoco fixes sorting - reason why capital letters sorted first because have lower ascii values.
here's table reference.
you can ascii value of string in vba using asc(mystring)
function.
Comments
Post a Comment