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.)
and the code for the conbobox exit is:
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