Hyperlink by macro

ashani

Active Member
Joined
Mar 14, 2020
Messages
345
Office Version
  1. 365
Platform
  1. Windows
Hi gurus,

In my spreadsheet I create a daily sheet to work on and with the help of macro - the sheet copies over and clear the main sheet to start a new day.

What i'm looking to do is to create an index sheet where all the sheet names list each time we run the macro with relevant hyperlink to the specific sheet.

Also, the hyperlink macro will run daily so I want to have functiionality to override hyperlink/cell if its the same name or only add the new sheet in index section.

Please can someone guide me.

Many thanks,
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I am not entirely sure of what you want but try this, it creates an index of the sheets in the workbook with hyperlinks to each sheet:
VBA Code:
Sub addindex()
  WS_Count = ActiveWorkbook.Worksheets.Count
  Worksheets("Index").Select
     rown = 2
      For jj = 1 To WS_Count
        If Worksheets(jj).Name <> "Index" Then
            newf = Worksheets(jj).Name & "!A1"
            With Worksheets("Index")
          .Hyperlinks.Add Anchor:=.Range(Cells(rown, 1), Cells(rown, 1)), _
                        Address:="", SubAddress:=newf, _
                        TextToDisplay:=newf
      End With
            rown = rown + 1
        End If
       Next jj



End Sub
 
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,734
Members
448,987
Latest member
marion_davis

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