Numerically Ordering Sheets

Jetx227

Board Regular
Joined
Jul 11, 2018
Messages
96
Hey guys,
So I have report workbooks where I have a bunch of items that have estimate sheets for. Each item is identified as a number and has a worksheet dedicated to each one (named by the number of the item). The first sheet in the workbook holds the summary table (so all the item numbers are in one column). I made a macro that creates a sheet for each item (because I have like 50 to 100+ sheets I could work with at a time, so it makes it much easier) and we tend to add items as we go so the macro can read the numbers and see we already have a worksheet for that item number. The only problem is that navigation can get hectic so it's nice to have them in numerical order to make things a bit easier, but since we go back and put new items in later, plenty of the sheets get out of order and mixed up and it takes a while to move them to the correct spots. I was wondering if anyone could help come up with code that I can add on to the macro that I have already that can sort the item sheets into numerical order (they all have numbers as names) but leave the summary and template sheets alone at the front of the workbook. Any suggestions would be much appreciated. Thanks!
 
Try this:
Now see my plan was to write a script which you could run every time you added or deleted new sheets.
But now since your manually entering the links on your sheets some other way then as you add more sheets you will have to run this script and then manually enter the links on all your new sheets manually like I assume you at now doing. Not sure why you wanted to do it manually but then you must have your reasons.


Code:
Sub New_One()
'Modified  7/12/2018  10:18:27 AM  EDT
Dim C As Range
Dim i As Long
Dim ans As String
ans = "Estimate" 'Modify this name if needed all sheet names will be put in Column "A" of this sheet
Sheets(ans).Activate
Sheets(ans).Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row).ClearContents
    
For i = 4 To Sheets.Count
    Sheets(ans).Cells(i - 2, 1).Value = Sheets(i).Name
    Next

With Sheets(ans)
    For Each C In .Range("A2:A" & .Range("A" & .Rows.Count).End(xlUp).Row)
        .Hyperlinks.Add Anchor:=C, Address:="", SubAddress:="'" & C.Value & "'!A1"
    Next C
End With

End Sub

yeah I'm really bad at explaining, so I'm not manually entering the links into my other sheets, I have another macro that creates all the sheets for me from a template that has a form button on it that acts as a link back to the master sheet. So I didn't need that part of the code because I had it automated already. But thank you, let me try this code and get back to you, I appreciate the help and patience lol.
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
So I got it all worked out now, the new code you gave me works great and I just added it into my code that creates the sheets. Thank you!
 
Upvote 0
Glad I was able to help you.
Come back here to Mr. Excel next time you need additional assistance.
So I got it all worked out now, the new code you gave me works great and I just added it into my code that creates the sheets. Thank you!
 
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top