Renaming sheets with hyperlink-HELP! :[

amateur717

New Member
Joined
Jul 3, 2011
Messages
2
Hi,

I am trying to create a macro that will enable me to create new sheets within a workbook, naming the new sheet with something in a certain cell, then hyperlinking that cell to the the sheet.

Please help!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
With a list of sheet names in Sheet1 column A starting in A1 try

Code:
Sub AddSheets()
Dim LR As Long, i As Long, ws As Worksheet
With Sheets("Sheet1")
    LR = .Range("A" & Rows.Count).End(xlUp).Row
    For i = 1 To LR
        Set ws = Worksheets.Add(after:=Worksheets(Worksheets.Count))
        ws.Name = .Range("A" & i).Value
        .Hyperlinks.Add Anchor:=.Range("A" & i), Address:="", SubAddress:="'" & ws.Name & "'!A1", TextToDisplay:=ws.Name
    Next i
End With
End Sub
 
Upvote 0
Awesome!!! Thank you so much!

-Now, how can i add onto that to make it so that each Sheet has the same template as a 'Template' sheet? i.e. copy an existing sheet, then renaming it with the contents of the cell, and hyperlinking that cell to the sheet?

This should be all i need to do.
 
Upvote 0
Try like this

Code:
Sub AddSheets()
Dim LR As Long, i As Long, ws As Worksheet
With Sheets("Sheet1")
    LR = .Range("A" & Rows.Count).End(xlUp).Row
    For i = 1 To LR
        Worksheets("Template").Copy after:=Worksheets(Worksheets.Count)
        Set ws = ActiveSheet
        ws.Name = .Range("A" & i).Value
        .Hyperlinks.Add Anchor:=.Range("A" & i), Address:="", SubAddress:="'" & ws.Name & "'!A1", TextToDisplay:=ws.Name
    Next i
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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