Hyperlink by macro

ashani

Board Regular
Joined
Mar 14, 2020
Messages
202
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,
 

Some videos you may like

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

offthelip

Well-known Member
Joined
Dec 23, 2017
Messages
1,721
Office Version
  1. 2010
Platform
  1. Windows
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
 

Watch MrExcel Video

Forum statistics

Threads
1,127,009
Messages
5,622,145
Members
415,881
Latest member
tasic89

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
Top