So I am new to VBA and I created a hyperlink that will take me to another page if it is selected. It will also tell me which cell was selected (which is important). However, it was way to big and I am stuck. It begins on 162 and goes to 344 and also needs to go from column J to column DD. PLEASE HELP!
Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)
'Update cell B2 in TEST sheet based on the origin of hyperlink
If Sh.Name = "Master" Then
If GSourceCell = "J162" Then
Sheets("TEST").Range("B2").Value = "Hyperlinked from cell J-162"
ElseIf GSourceCell = "J163" Then
Sheets("TEST").Range("B2").Value = "Hyperlinked from cell J-163"
ElseIf GSourceCell = "J164" Then
Sheets("TEST").Range("B2").Value = "Hyperlinked from cell J-164"
ElseIf GSourceCell = "J165" Then
Sheets("TEST").Range("B2").Value = "Hyperlinked from cell J-165"
ElseIf GSourceCell = "J166" Then
Sheets("TEST").Range("B2").Value = "Hyperlinked from cell J-166"
ElseIf GSourceCell = "J168" Then
Sheets("TEST").Range("B2").Value = "Hyperlinked from cell J-168"
etc....
Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)
'Update cell B2 in TEST sheet based on the origin of hyperlink
If Sh.Name = "Master" Then
If GSourceCell = "J162" Then
Sheets("TEST").Range("B2").Value = "Hyperlinked from cell J-162"
ElseIf GSourceCell = "J163" Then
Sheets("TEST").Range("B2").Value = "Hyperlinked from cell J-163"
ElseIf GSourceCell = "J164" Then
Sheets("TEST").Range("B2").Value = "Hyperlinked from cell J-164"
ElseIf GSourceCell = "J165" Then
Sheets("TEST").Range("B2").Value = "Hyperlinked from cell J-165"
ElseIf GSourceCell = "J166" Then
Sheets("TEST").Range("B2").Value = "Hyperlinked from cell J-166"
ElseIf GSourceCell = "J168" Then
Sheets("TEST").Range("B2").Value = "Hyperlinked from cell J-168"
etc....