Put the four sheets at the beginning of the workbook and change the "for x =1to worksheets.count". To "for x = 5 to worksheets.count"
On Friday, 18 January 2013, Yahya Muhammad wrote: > Dear Experts > > I have a workbook with a no. of worksheets. New worksheets are being added > to it regularly. I am using below code to sort the worksheets after the > addition of any new sheets. Now I need your help to modify this code so > that it will keep some of the sheets (say named "Summary", "Profile", > "Help", "Targets") unaltered: > > 1. At the beginning of the workbook OR > 2. At the end of the work book. > > Thanks in advance > > Sub Sortem() > > Dim x As Long, y As Long > > For x = 1 To Worksheets.Count > > For y = x To Worksheets.Count > > > > If UCase(Sheets(y).Name) < UCase(Sheets(x).Name) Then > > Sheets(y).Move Before:=Sheets(x) > > End If > > Next > > Next > > End Sub > > -- > Join official Facebook page of this forum @ > https://www.facebook.com/discussexcel > > FORUM RULES > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > 2) Don't post a question in the thread of another member. > 3) Don't post questions regarding breaking or bypassing any security > measure. > 4) Acknowledge the responses you receive, good or bad. > 5) Jobs posting is not allowed. > 6) Sharing copyrighted material and their links is not allowed. > > NOTE : Don't ever post confidential data in a workbook. Forum owners and > members are not responsible for any loss. > --- > You received this message because you are subscribed to the Google Groups > "MS EXCEL AND VBA MACROS" group. > To post to this group, send email to > excel-macros@googlegroups.com<javascript:_e({}, 'cvml', > 'excel-macros@googlegroups.com');> > . > To unsubscribe from this group, send email to > excel-macros+unsubscr...@googlegroups.com <javascript:_e({}, 'cvml', > 'excel-macros%2bunsubscr...@googlegroups.com');>. > Visit this group at http://groups.google.com/group/excel-macros?hl=en. > > > -- Regards David Grugeon -- Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To post to this group, send email to excel-macros@googlegroups.com. To unsubscribe from this group, send email to excel-macros+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros?hl=en.