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. ascii values

you can ascii value of string in vba using asc(mystring) function.


Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -