I have a log file that just keeps being added to. i want to create a template Log that has a sheet with a summary of the different "EX" tabs. where each line has a link to the correct Tab.
i'd like to click a button to copy the template sheet in numeric order:
Then i want to be able to copy the line in the summary sheet down 1 row and maintain the links, only to the new sheet.PHP Code:
Public Sub SheetCopy()
Dim Sh As Worksheet, TemplateSh As Worksheet
Dim ShNum As Integer, HighestNum As Integer
Dim SheetCoreName As String
' INDICATE THE CORE SHEET NAME
SheetCoreName = "EX "
' INDICATE THE SOURCE SHEET
Set TemplateSh = Sheets("Template")
' DETERMINE NEXT NUMBER FOR SHEET
For Each Sh In Worksheets
If InStr(1, Sh.Name, SheetCoreName) = 1 Then
ShNum = Val(Right(Sh.Name, Len(Sh.Name) - Len(SheetCoreName)))
If ShNum > HighestNum Then HighestNum = ShNum
End If
Next Sh
' COPY TEMPLATE
TemplateSh.Copy after:=Sheets(Sheets.Count)
' MAKE VISIBLE
ActiveSheet.Visible = xlSheetVisible
' RENAME
ActiveSheet.Name = SheetCoreName & HighestNum + 1
End Sub
Private Sub CommandButton1_Click()
Run "SheetCopy"
End Sub
Bookmarks