creating hyperlinks within a range that use a cells value as each hyperlinks name

kbishop94

Active Member
Joined
Dec 5, 2016
Messages
476
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Whats not working with this code is that instead of using each cell's value, its using the value of the last cell in the range for every cell in the range.
(the last cell in the range is A211, and the hyperlink for every cell from A1 to A211 are all the same(?)... they all are the same value as the last cell- cell A211. How can I make it so that each cell's hyperlink is the same as that cells value?) Thanks!

VBA Code:
Private Sub CommandButton1_Click()
Dim cNam As Variant

    For Each cNam In Range(Cells(1, 1), Cells(211, 1))
        Hyperlinks.Add Range(Cells(1, 1), Cells(211, 1)), "J:\QMS_General Facility\Training\Employee_Training_Records\" & cNam.value
    Next cNam

End Sub
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Code:
Public Sub CreateHypers()
Dim cNam As Variant
    For Each cNam In Range(Cells(1, 1), Cells(211, 1))
        ActiveCell.Hyperlinks.Add cNam, "J:\QMS_General Fac1ility\Training\Employee_Training_Records\" & cNam.Value
    Next cNam
  

MsgBox "Done"
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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