Results 1 to 7 of 7

Adding VBA Hyperlink to each worksheet

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2013, 2019 & O365
    Posts
    214

    Exclamation Adding VBA Hyperlink to each worksheet

    Hi All,

    I have got some useful codes for my project to automatically generating worksheets of each individual employee in the active workbook. Please see below codes for the same:

    Private Sub CommandButton1_Click()
    ' VBA Routine to Add and Name Worksheets
    
        Call CreateWorksheets(Sheets("Monthly Productivity Data").Range("A2:A11"))
    
    End Sub
    Option Explicit
    
    ' In a Module
    
    Sub CreateWorksheets(Names_Of_Sheets As Range)
    Dim No_Of_Sheets_to_be_Added As Integer
    Dim Sheet_Name As String
    Dim i As Integer
    
        No_Of_Sheets_to_be_Added = Names_Of_Sheets.Rows.Count
        
        For i = 1 To No_Of_Sheets_to_be_Added
        
            Sheet_Name = Names_Of_Sheets.Cells(i, 1).Value
            
            ' Only add sheet if it doesn't exist already and the name is longer than zero characters
            
            If (Sheet_Exists(Sheet_Name) = False) And (Sheet_Name <> "") Then
                Worksheets.Add().Name = Sheet_Name
            End If
            
        Next i
    
    Call CountMySheets      ' Count the sheets in a Workbook
    
    End Sub
    ' =======================================================
    
    Function Sheet_Exists(WorkSheet_Name As String) As Boolean
    Dim Work_sheet As Worksheet
    
    Sheet_Exists = False
    
    For Each Work_sheet In ThisWorkbook.Worksheets
    
        If Work_sheet.Name = WorkSheet_Name Then
            Sheet_Exists = True
        End If
    
    Next
    
    End Function
    ' =======================================================
    
    Public Sub CountMySheets()
    ' Count the sheets in a Workbook
    
        MsgBox "Total Number of Worksheets in this Workbook = " & Application.Sheets.Count
    End Sub

    Could you please tell me how to automatically add hyperlinks from each employee's ID to his unique individual worksheet, so whenever we run the above codes for automatically generating the worksheets, then all of those worksheets have a hyperlink form the main worksheet - "Monthly Productivity Data".

    For example: If a new sheet is generated with a name as Tom Cruise then a hyperlink should appear on his ID on the main worksheet Monthly Productivity Data. so we can visit his unique worksheet on a simple click.

    Workbook: MS Excel 2003

    Thanks in advance!

    Plz find the attached workbook for more details.
    Attached Files Attached Files
    Last edited by SunOffice; 03-23-2011 at 08:52 PM.
    Excelforum is Completely Awesome! True learning with Live Examples & Best Techniques!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1