Pirate_tat87
New Member
- Joined
- Apr 2, 2024
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
I am 100% new to using VBA and so there for I need some help. I also want to learn too
I have workbook I am currently working on right now as a test book so I don't mess up my real book
I have two work sheets that are currently created.
Lets say in "sheet1" in I have a cell with the phrase "Go To Sheet"
Lets say in "Sheet2" I name that sheet "test"
I have the current VBA script that I found that does work only when the "Cell Name" and "Sheet Name" match - the effect is when i click on the cell name on sheet1 while sheet2 is hidden, sheet2 will appear and when i click off sheet2 it will hide and only sheet1 will remain visible.
Where I need help is where I can still have the same effect but have it on the phrase "Go To Sheet" and then have the second Sheet Name different then the "Go To Sheet"
I have workbook I am currently working on right now as a test book so I don't mess up my real book
I have two work sheets that are currently created.
Lets say in "sheet1" in I have a cell with the phrase "Go To Sheet"
Lets say in "Sheet2" I name that sheet "test"
I have the current VBA script that I found that does work only when the "Cell Name" and "Sheet Name" match - the effect is when i click on the cell name on sheet1 while sheet2 is hidden, sheet2 will appear and when i click off sheet2 it will hide and only sheet1 will remain visible.
VBA Code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
'Updateby Extendoffice
Application.ScreenUpdating = False
Dim strLinkSheet As String
If InStr(Target.Parent, "!") > 0 Then
strLinkSheet = Left(Target.Parent, InStr(1, Target.Parent, "!") - 1)
Else
strLinkSheet = Target.Parent
End If
Sheets(strLinkSheet).Visible = True
Sheets(strLinkSheet).Select
Application.ScreenUpdating = True
End Sub
Private Sub Worksheet_Activate()
On Error Resume Next
Sheets(ActiveCell.Value2).Visible = False
End Sub
Where I need help is where I can still have the same effect but have it on the phrase "Go To Sheet" and then have the second Sheet Name different then the "Go To Sheet"