• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

I need help for creating hyperlinks.

ThrottleWorks

Excel Ninja
Hi,


I need help for creating hyperlinks.

I have multiple worksheets in my workbook (around 500).

All the sheets are named in a date format.

I have created an index file where hyperlink is provided for each sheet.


The problem I am facing is, the number of sheets are getting increased everyday & I have to create hyperlink for these sheets manually.


Is there any formula or vba code, where I will be able create the hyperlink automatically on the basis of sheets added.


I tried with list box (without VBA) but could get through, please help.
 
Sachinbizboy


500 sheets in a file ?


I would seriously look to shifting the data to a single sheets or even to an Access or SQL data base


How many records per day ?
 
Hi Sir,


extremally sorry for the late reply, was busy in other work.


Only 1 sheets gets add per day.


Have a nice week end.... Sir I do not know Access or SQL
 
Here is some vba code that I have written that creates an "Index Sheet" at the beginning of the workbook.


You could update the code to delete the Index Sheet before it runs each time that way you don't have to manually do it?


Option Explicit


Public Sub SheetNames()

'Macro created for Carlyle Coinvest

'Macro by Matt Nuttall


Dim i As Variant

Dim MainWks As Worksheet

Dim r As Long

Dim Wks As Worksheet

Dim x As Long

Dim F As Variant


Application.ScreenUpdating = False


Worksheets(1).Activate

Worksheets.Add().Name = "Index Sheet"

Worksheets("Index Sheet").Activate


Set MainWks = Worksheets("Index Sheet")


For Each Wks In Worksheets

If Wks.Name <> MainWks.Name Then

r = r + 1

With MainWks

.Hyperlinks.Add Anchor:=.Cells(r, "A"), _

Address:="", _

SubAddress:="'" & Wks.Name & "'!A1", _

TextToDisplay:=Wks.Name

End With

End If

Next Wks


Columns("A:A").Select

Selection.Insert Shift:=xlToRight


Range("A1").Value = 2

Range("A2").Value = 3


With ActiveSheet

x = .Cells(.Rows.Count, "B").End(xlUp).Row

End With


Range("A1:A2").Select


F = Range(Cells(1, ActiveCell.Column), Cells(x, ActiveCell.Column)).Address(False, False)

With Selection

.AutoFill Destination:=Range(F)

End With


Range("A1").CurrentRegion.Copy Range("F1")


Columns("A:B").Select

ActiveWorkbook.Worksheets("Index Sheet").Sort.SortFields.Clear

ActiveWorkbook.Worksheets("Index Sheet").Sort.SortFields.Add Key:=Range( _

"B1:B200"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _

xlSortNormal

With ActiveWorkbook.Worksheets("Index Sheet").Sort

.SetRange Range("A1:B200")

.Header = xlNo

.MatchCase = False

.Orientation = xlTopToBottom

.SortMethod = xlPinYin

.Apply

End With


Range("A1").EntireRow.Insert Shift:=xlDown

Range("A1").EntireRow.Insert Shift:=xlDown

Range("A1").EntireRow.Insert Shift:=xlDown

Range("A1").EntireRow.Insert Shift:=xlDown

Range("A1").EntireRow.Insert Shift:=xlDown


Range("A4").Value = "Alphabetized"

Range("A5").Value = "Tab Number"

Range("B5").Value = "Sheet Name"

Range("A4:B4").MergeCells = True


Range("F4").Value = "Workbook Order"

Range("F5").Value = "Tab Number"

Range("G5").Value = "Sheet Name"

Range("F4:G4").MergeCells = True


Range("A4:B4,F4:G4").Font.Bold = True

Range("A4:B4,F4:G4").HorizontalAlignment = xlCenter

Range("A5:B5,F5:G5").Font.Underline = xlUnderlineStyleSingle


Range("A1").Select

Range("A1").Value = "Table of Contents"

Range("A1:G2").MergeCells = True

Range("A1:G2").HorizontalAlignment = xlCenter

With Selection.Font

.Name = "Arial"

.Size = 20

End With

With Selection.Interior

.Pattern = xlSolid

.PatternColorIndex = xlAutomatic

.ThemeColor = xlThemeColorLight2

.TintAndShade = 0.599993896298105

.PatternTintAndShade = 0

End With


Columns("A:G").EntireColumn.AutoFit


Range("A1").Select

Application.ScreenUpdating = True


End Sub


Good luck.
 
Hi mnuttall87, thank a lot for the support & your time.


I am trying this, will definately share the results.


Have a nice weekend.
 
Glad it was useful. Adding in a bit of code to delete the Index Sheet so that you can just run it would probably be beneficial in your scenario it sounds like.
 
Back
Top