Vikungr
12-10-2020, 06:41 AM
I am currently working on a document for work whereby I used vba to create a basic search return system. The issue I am having is one of my return columns contains links. When the search is complete the links are pulled through but are not active hyperlinks.
Is there some way to pull them through as links not just text? Code is provided for the search function below. Colun with links is x,5 in the code.
Sub SearchAFCS()
Dim erow As Long
Dim ws As Worksheet
Dim lastrow As Long
Dim count As Integer
lastrow = Sheets("AFCS2").Cells(Rows.count, 1).End(xlUp).Row
count = 0
Dim c As Long
d = 12
For x = 2 To lastrow
If Sheets("AFCS2").Cells(x, 1) = Sheets("AFCS").Range("F6") Then
Sheets("AFCS").Cells(d, 4) = Sheets("AFCS2").Cells(x, 1)
Sheets("AFCS").Cells(d, 6) = Sheets("AFCS2").Cells(x, 2)
Sheets("AFCS").Cells(d, 8) = Sheets("AFCS2").Cells(x, 3)
Sheets("AFCS").Cells(d, 9) = Sheets("AFCS2").Cells(x, 4)
Sheets("AFCS").Cells(d, 14) = Sheets("AFCS2").Cells(x, 5)
d = d + 1
count = count + 5
End If
Next x
MsgBox "Search Complete. To perform another search, Clear the results and select a new category."
End Sub
Is there some way to pull them through as links not just text? Code is provided for the search function below. Colun with links is x,5 in the code.
Sub SearchAFCS()
Dim erow As Long
Dim ws As Worksheet
Dim lastrow As Long
Dim count As Integer
lastrow = Sheets("AFCS2").Cells(Rows.count, 1).End(xlUp).Row
count = 0
Dim c As Long
d = 12
For x = 2 To lastrow
If Sheets("AFCS2").Cells(x, 1) = Sheets("AFCS").Range("F6") Then
Sheets("AFCS").Cells(d, 4) = Sheets("AFCS2").Cells(x, 1)
Sheets("AFCS").Cells(d, 6) = Sheets("AFCS2").Cells(x, 2)
Sheets("AFCS").Cells(d, 8) = Sheets("AFCS2").Cells(x, 3)
Sheets("AFCS").Cells(d, 9) = Sheets("AFCS2").Cells(x, 4)
Sheets("AFCS").Cells(d, 14) = Sheets("AFCS2").Cells(x, 5)
d = d + 1
count = count + 5
End If
Next x
MsgBox "Search Complete. To perform another search, Clear the results and select a new category."
End Sub