I have a macro (thank you watersev!) that finds a cell reference in my worksheet based on a search value and returns a clickable hyperlink to send me to that cell in my worksheet.
What I want is that in my "Start" sheet on cells D9 downwards I want it to look into the hyperlink that is created in C9 downwards, and if that cell reference hyperlinked is less than 190, return the word Premium, and if not then return AP/RP. As per my example in the attached.
The macro that fires when you hit the search button currently does the following:
Sub test()
Dim lrow As Long, n As Long, i As Long, mainsh As Worksheet, c As Range, rcount As Long
Dim search_val, Sh, resultarr, addrarr, temparr, cl
Dim shname As String, firstAddress As String, addrstr As String, resultstr As String
lrow = Cells(Rows.Count, 2).End(xlUp).Row
If lrow > 9 Then Range("b9:c" & lrow).Clear
If Range("a3") = "" Then Exit Sub
search_val = Range("a3")
Application.ScreenUpdating = 0
Application.EnableEvents = 0
Set mainsh = Sheets("Start")
For Each Sh In ActiveWorkbook.Sheets
If InStr("GraphsStartSummary", Sh.Name) = 0 Then
If Sh.Visible = True Then
lrow = Sh.Cells(Rows.Count, "c").End(xlUp).Row
If lrow > 16 Then
shname = Sh.Name
With Sh.Range("c17", Sh.Cells(Rows.Count, "c").End(xlUp))
iflag = Sh.Rows(17).Hidden
If iflag = True Then Sh.Rows(17).Hidden = False
Set c = .Find("*" & search_val & "*", , xlValues, xlWhole)
If Not c Is Nothing Then
firstAddress = c.Address
Do
If addrstr = "" Then addrstr = "'" & shname & "'!" & c.Address Else addrstr = addrstr & "|'" & shname & "'!" & c.Address
If resultstr = "" Then resultstr = c.Value & "~" & shname Else resultstr = resultstr & "|" & c.Value & "~" & shname
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
Sh.Rows(17).Hidden = iflag
End With
End If
End If
End If
Next
If resultstr <> "" Then
resultarr = Split(resultstr, "|")
addrarr = Split(addrstr, "|")
rcount = UBound(resultarr)
ReDim result(0 To rcount, 0 To 1)
For i = 0 To rcount
temparr = Split(resultarr(i), "~")
result(i, 0) = temparr(0)
result(i, 1) = temparr(1)
Next
With mainsh.Range("b9:c" & rcount + 9)
.NumberFormat = "@"
.Value = result
For Each cl In .Offset(, 1).Resize(, 1)
cl.Hyperlinks.Add cl, "", addrarr(n), , cl.Value
n = n + 1
Next
End With
End If
Application.EnableEvents = 1
Application.ScreenUpdating = 1
End Sub
Bookmarks