Prev: Sheet codename not working
Next: How do I print xls file into two separate columns on the page?
From: JStiehl on 1 Jun 2010 08:26 I need help with VBA code to sort tab names with numbers in order, but leave the ones with words as they are. Tab names with numbers should precede the tabs with words. I have searched and can only find codes to sort alphanumerically. Thanks for your help. Example of what order I would like my tabs in: 123890 456678 789123 Project1 Project2 Project3 Total Findings
From: Don Guillett on 1 Jun 2010 08:47 http://support.microsoft.com/kb/812386 -- Don Guillett Microsoft MVP Excel SalesAid Software dguillett(a)gmail.com "JStiehl" <JStiehl(a)discussions.microsoft.com> wrote in message news:419F7C3A-D76E-420C-A635-45F258670062(a)microsoft.com... >I need help with VBA code to sort tab names with numbers in order, but >leave > the ones with words as they are. Tab names with numbers should precede > the > tabs with words. I have searched and can only find codes to sort > alphanumerically. Thanks for your help. > > Example of what order I would like my tabs in: > > 123890 > 456678 > 789123 > Project1 > Project2 > Project3 > Total > Findings
From: Bob Phillips on 1 Jun 2010 09:07 See http://www.cpearson.com/excel/sortws.aspx -- HTH Bob "JStiehl" <JStiehl(a)discussions.microsoft.com> wrote in message news:419F7C3A-D76E-420C-A635-45F258670062(a)microsoft.com... >I need help with VBA code to sort tab names with numbers in order, but >leave > the ones with words as they are. Tab names with numbers should precede > the > tabs with words. I have searched and can only find codes to sort > alphanumerically. Thanks for your help. > > Example of what order I would like my tabs in: > > 123890 > 456678 > 789123 > Project1 > Project2 > Project3 > Total > Findings
From: Jacob Skaria on 1 Jun 2010 09:18 Try Sub Macro() Dim lngCount1 As Long, lngCount2 As Long For lngCount1 = 1 To Sheets.Count - 1 For lngCount2 = lngCount1 + 1 To Sheets.Count If IsNumeric(Sheets(lngCount1).Name) And _ IsNumeric(Sheets(lngCount2).Name) Then If CCur(Sheets(lngCount1).Name) > CCur(Sheets(lngCount2).Name) Then _ Sheets(lngCount1).Move After:=Sheets(lngCount2): Exit For End If Next Next End Sub -- Jacob (MVP - Excel) "JStiehl" wrote: > I need help with VBA code to sort tab names with numbers in order, but leave > the ones with words as they are. Tab names with numbers should precede the > tabs with words. I have searched and can only find codes to sort > alphanumerically. Thanks for your help. > > Example of what order I would like my tabs in: > > 123890 > 456678 > 789123 > Project1 > Project2 > Project3 > Total > Findings
From: Jacob Skaria on 1 Jun 2010 09:47 Try this instead.. Sub Macro() Dim lngCount1 As Long, lngCount2 As Long For lngCount1 = 1 To Sheets.Count For lngCount2 = lngCount1 + 1 To Sheets.Count If Sheets(lngCount1).Name > Sheets(lngCount2).Name Then _ Sheets(lngCount1).Move After:=Sheets(lngCount2): Exit For Next Next End Sub -- Jacob (MVP - Excel) "Jacob Skaria" wrote: > Try > > Sub Macro() > Dim lngCount1 As Long, lngCount2 As Long > For lngCount1 = 1 To Sheets.Count - 1 > For lngCount2 = lngCount1 + 1 To Sheets.Count > If IsNumeric(Sheets(lngCount1).Name) And _ > IsNumeric(Sheets(lngCount2).Name) Then > If CCur(Sheets(lngCount1).Name) > CCur(Sheets(lngCount2).Name) Then _ > Sheets(lngCount1).Move After:=Sheets(lngCount2): Exit For > End If > Next > Next > End Sub > > > -- > Jacob (MVP - Excel) > > > "JStiehl" wrote: > > > I need help with VBA code to sort tab names with numbers in order, but leave > > the ones with words as they are. Tab names with numbers should precede the > > tabs with words. I have searched and can only find codes to sort > > alphanumerically. Thanks for your help. > > > > Example of what order I would like my tabs in: > > > > 123890 > > 456678 > > 789123 > > Project1 > > Project2 > > Project3 > > Total > > Findings
|
Next
|
Last
Pages: 1 2 Prev: Sheet codename not working Next: How do I print xls file into two separate columns on the page? |