VBA code Create Hyperlink to direct to cell content in another sheet

UDK

New Member
Joined
May 12, 2021
Messages
4
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi ,
I want to create a Hyperlink in Sheet2 of column 1, that direct to the address mentioned in sheet2(Rowno and Column) to Sheet1. Attached the Excel Sheet for your reference. Thank you in advance.

Sheet1:
Hyperlink test.xlsx
ABCDEF
1ABCDEF
2824732635182
3693749454662
4254867589973
569455396959
65593087598
7728991976274
8527299329915
9837499541972
101487731821
11245552267460
12774753521967
1356577087221
14223184247591
15834477942899
16663045507240
1765554621150
18776087286071
19476313125721
20602814121355
21336271551727
224810026865141
23759022535159
241009487335877
2583273567125
2632164348492
279046709955
28112256624731
299797099433
30493726468194
3189332643864
3291553847034
335342408258
34162100617290
35755913411925
36435582506758
37456187729243
38134252752364
39518539658183
4079454981281
41338664746861
42983330652077
43136719962025
44598884919829
453499236266
46339611112080
47343621709171
48717960103339
4993848108397
501007099253074
51523328272685
5288378558749
Sheet1
 

Attachments

  • test_sheet2.JPG
    test_sheet2.JPG
    18.9 KB · Views: 14

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
You could try the below

VBA Code:
Sub Hyperlinks()
    Dim i As Long, wks As Worksheet, wks2 As Worksheet
    Set wks = Worksheets("Sheet1")
    Set wks2 = Worksheets("Sheet2")
    
    For i = 2 To wks2.Range("A" & Rows.Count).End(xlUp).Row
        With wks2
            .Hyperlinks.Add Anchor:=.Cells(i, 1), Address:="", SubAddress:=wks.Name & "!" & .Cells(i, 2).Value & .Cells(i, 1).Value
        End With
    Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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