need help with my 'get record' sub when the target cell is a hyperlink...

kbishop94

Active Member
Joined
Dec 5, 2016
Messages
458
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
my code within my userform under the 'Sub GetRecord' functions fine (locates the target cell in the worksheet based on selection in combobox) but when the cell value is in hyperlink form, I get an error that the record wasnt found. If I remove the hyperlinks from that column, then it locates and populates the userform just fine. I believe from googling this and reading other threads that I somehow need to qualify those cells in that range as being "links"... but I couldn't find any examples of how exactly to do that. (so I am reaching out here to see if someone can assist me.)

Here is the code that I am working with:
(RecordRow, 3) is the row that contains the value that the combobox (cboFN) is trying to match up to.)
VBA Code:
Sub GetRecord(ByVal RecordRow As Long)
'
    Dim ckALL As String
    Dim ckTYPE As String
    Dim ckDEPT As String
    Dim ckPAR As String
    Dim ckFAC As String
    Dim ckFault As String
    Dim ws As Worksheet
    Set ws = Object2
'
    With Me
        .cboFN.value = ws.Cells(RecordRow, 3).Text
        .txtRevDate.value = ws.Cells(RecordRow, 5)
        .txt24Mo.value = ws.Cells(RecordRow, 4)
        .txtProRe.value = ws.Cells(RecordRow, 6)
'
        ckTYPE = ws.Cells(RecordRow, 2).Text
        ckDEPT = ws.Cells(RecordRow, 1).Text
        ckFAC = ws.Cells(RecordRow, 7).Text
        ckPAR = ws.Cells(RecordRow, 8).Text
'
        On Error Resume Next
'
        ckALL = Application.WorksheetFunction.VLookup((Me.cboFN), Object2.Range("DynamicRange"), 1, 0)
        ckALL = ws.Cells(RecordRow, 1).Text
'

and the code for the conbobox exit is:
VBA Code:
Private Sub cboFN_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Dim FoundCell As Range
    Dim Search As String
    Dim RecordRow As Long
    Dim ctlx
    Set ws = Worksheets("Employee Training Matrix")
'
    Search = Me.cboFN.value
    Set FoundCell = Object2.Range("C:C").Find(Search, LookAt:=xlWhole, LookIn:=xlValues)
'
    If Not FoundCell Is Nothing Then
        GetRecord FoundCell.Row
    Else
        MsgBox Search & Chr(10) & "Incident ID not found.", 48, "Not Found"
'
        Me.cboFN.value = ""
'
        Cancel = True
    End If
'
Me.cmdAdd1.Enabled = Not Cancel
'
    If Not FoundCell Is Nothing Then
        GetRecord FoundCell.Row
    Else
        MsgBox Search & Chr(10) & "Document: ", 48, " Not Found "
        Me.cboFN.value = ""
        Cancel = True
    End If
'
lblProtect.Height = 6
lblDocSelectedOVERLAY.BackStyle = fmBackStyleTransparent
'
End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,215,193
Messages
6,123,560
Members
449,108
Latest member
rache47

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