Incorrect Hyperlink/ Hyperlinking with VBA

TheDaveF

New Member
Joined
Aug 26, 2014
Messages
8
I have hyperlinked pdf drawings to drawing numbers detailed in cells. However the hyperlink will not work as it goes to another location, different to the one I had specified. I have seen multiple sites with people discussing this. Here is my code, but I don't think it is a code issue. I have around 2000 drawings so manually hyperlinking is something I really do not want to do.

Any help you could provide would much appreciated.

Sub CreateHyperLinker()
Dim ws As Worksheet
Dim x As Long
Dim strFile As String
Dim strPath As String

Set ws = ThisWorkbook.Sheets("Full List")
Sheets("Full List").Range("D2") = ws.Name

strPath = "C:\Users\SS7U6170\Desktop\Atlantic drawings\0 General"
Sheets("Full List").Range("D3") = strPath
With ws
x = 22
Sheets("Full List").Range("D4").Value = x

rng = 3
Sheets("Full List").Range("D5").Value = rng

For c = rng To x
Sheets("Full List").Cells(c, 5).Value = c

aa = c
Sheets("Full List").Cells(c, 6).Value = aa

bb = "a" & aa
Sheets("Full List").Cells(c, 7) = bb

dd = "b" & aa
Sheets("Full List").Cells(c, 8).Value = dd

xx = ws.Range(bb)
Sheets("Full List").Cells(c, 9).Value = xx

ee = ws.Range(dd)
Sheets("Full List").Cells(c, 10).Value = ee

Range(bb).Activate
Sheets("Full List").Cells(c, 11).Value = Range(bb).Activate

cc = "713" + "-" + Left(xx, 3) + "-" + Mid(xx, 5, 2) + "-" + Right(xx, 3) + "_" + ee + ".PDF"
Sheets("Full List").Cells(c, 12).Value = cc

strFile = cc
Sheets("Full List").Cells(c, 13).Value = strFile

strFile = Dir(strPath & strFile)
Sheets("Full List").Cells(c, 14).Value = strFile

If strFile = Dir(strPath & strFile) Then _
Sheets("Full List").Cells(c, 1).Hyperlinks.Add Sheets("Full List").Cells(c, 1), strFile

Next
End With

End Sub
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,214,587
Messages
6,120,406
Members
448,958
Latest member
Hat4Life

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