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

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

php - facebook and github login HWIOAuthBundle and FOSUserBundle in Symfony2.1 -

hadoop - Sqoop installation export and import from postgresql -