VBA support in Hyperlink

sksanjeev786

Well-known Member
Joined
Aug 5, 2020
Messages
881
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi Team,

I have 40 tabs and with the help of macro, I have consolidated all tabs names in 1 sheet.

So no I wanted to hyperlink each tab name available in 1 sheet with the Actual tab Sheet.

Can anyone help me with this

Regards,
Sanjeev
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Code:
Sub BuildSheetHypers()
Dim ws As Worksheet
Const kNDX = "index"

Sheets.Add
ActiveSheet.Name = kNDX
Range("A1").Value = "SheetIndex"
Range("A2").Select
For Each ws In Sheets
   If ws.Name <> kNDX Then
        ActiveCell.FormulaR1C1 = ws.Name
        ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:=ws.Name & "!A1", TextToDisplay:=ws.Name
      
        ActiveCell.Offset(1, 0).Select 'next row
   End If
Next
Set ws = Nothing
MsgBox "done"
End Sub
 
Upvote 0
Code:
Sub BuildSheetHypers()
Dim ws As Worksheet
Const kNDX = "index"

Sheets.Add
ActiveSheet.Name = kNDX
Range("A1").Value = "SheetIndex"
Range("A2").Select
For Each ws In Sheets
   If ws.Name <> kNDX Then
        ActiveCell.FormulaR1C1 = ws.Name
        ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:=ws.Name & "!A1", TextToDisplay:=ws.Name
     
        ActiveCell.Offset(1, 0).Select 'next row
   End If
Next
Set ws = Nothing
MsgBox "done"
End Sub
Waw!!!!! simply Awesome.

Can we have a back option for each tabs like if click to sheet 40 and after that I want to jump Sheet 1(where all links are available)
 
Upvote 0
before the NEXT ROW line:
try

'choose your cell for the BACK link:
ws.range("A1").formulaR1C1 = "sheet1"
ws.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:="sheet1!A1", TextToDisplay:="Sheet1"
 
Upvote 0
before the NEXT ROW line:
try

'choose your cell for the BACK link:
ws.range("A1").formulaR1C1 = "sheet1"
ws.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:="sheet1!A1", TextToDisplay:="Sheet1"

Hi Ranman:)

Not able to execute the above macro.

Regards,
Sanjeev
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,487
Members
448,967
Latest member
visheshkotha

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