I'm trying to hyperlink quote names in a workbook to the location of the files. Not all of the files are present, I would like to test against a boolean to see if they exist before creating the hyperlink. I have been using the filename from active cell to retain a string and search. The naming convention is 'XX-MMDDYY.XX. Saved files are under the name Quote_XX-MMDDYY.XX. I have combined "Quote_" wit the active cell to search for the file, but my macro only seems to loop through the list.
Sub LoopRange()
Dim currRow As Integer, lastRow As Integer
Dim ws As String, quoteID As String
Dim path As String
Dim FileName As String
path = "C:\Some file path\"
ws = "Quote LOG"
currRow = 3
lastRow = Sheets(ws).Cells(Sheets(ws).Rows.Count, "A").End(xlUp).Row
While currRow <= lastRow
Sheets(ws).Cells(currRow, 1).Select
quoteID = "Quote_" & ActiveCell.value
FileName = path & quoteID
If Dir(FileName) <> "" And quoteID <> "" Then
Sheets(ws).Hyperlinks.Add anchor:=Cells(currRow, 2), Address:=FileName, TextToDisplay:=quoteID
End If
currRow = currRow + 1
Wend
End Sub