Question about VBA Code

Racquet

Board Regular
Joined
Feb 3, 2006
Messages
80
I found some code that works very nicely for navigating from one worksheet to another. The first worksheet has hyperlinks to the other worksheets, and all of the other worksheets have a hyperlink back to the first sheet. When a new worksheet is added to the workbook, the new sheet is automatically listed in alphabetical order on the first sheet. Works great.

Except, if I want to copy an amount from one sheet to the other, the edit/paste functionality does not work if I rely on the hyperlink for navigation. I can copy data from one sheet to another, but I can't figure out why this functionality does not work if I use the hyperlink navigation.

Is there something that I can do revise the code below?


Code:
Option Explicit

Private Sub Worksheet_Activate()
ActiveWindow.DisplayGridlines = False
Dim wSheet As Worksheet
Dim l As Long
l = 1

    With Me
        .Columns(1).ClearContents
        .Cells(1, 1) = "List of Worksheet Tabs"
        .Cells(1, 1).Name = "Index"
    End With
    
    For Each wSheet In Worksheets
        If wSheet.Name <> Me.Name Then
            l = l + 1
                With wSheet
                    .Range("A1").Name = "Start_" & wSheet.Index
                    .Hyperlinks.Add Anchor:=.Range("A1"), Address:="", _
                    SubAddress:="Index", TextToDisplay:="Back to List of Worksheet Tabs"
                End With
                
                Me.Hyperlinks.Add Anchor:=Me.Cells(l, 1), Address:="", _
                SubAddress:="Start_" & wSheet.Index, TextToDisplay:=wSheet.Name
        End If
    Next wSheet
End Sub


Many thanks if someone can answer this for me.
 
Last edited by a moderator:

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I think to get an answer on this you will need to provide some details in terms of when & what you're trying to copy.

The code provided (note Smitty added CODE tags for you) is merely showing how the hyperlinks are created nothing more so it's difficult to comment without knowing exactly what and when you're looking to copy things from sheet x to sheet y.
 
Upvote 0

Forum statistics

Threads
1,214,885
Messages
6,122,085
Members
449,064
Latest member
MattDRT

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