I have two text boxes in a user form. Text box one is a unique user reference, the second, the unique case reference number.
In the sheet (marked Database) is the combined value of these two boxes (column B) which I am trying to do is concatenate the two text box values and search the database range. (Letters is the user form name)
Once found I want to copy the value from the text box "Browse" which holds a file location and paste it into an offset cell and then make it a hyperlink.
I'm close but can't quite finish it. Can anyone help me with what I am doing wrong?
Private Sub CommandButton2_Click()
Dim UserId, CaseId, SearchString As String
UserId = Letters.User.Value
CaseId = Letters.CaseNo.Value
SearchString = UserId & CaseId
' Search Case Reference Number column from database based on two values in User Form
'
'
Letters.Browse.Text.Copy
With Sheets("Database").Find(What:="SearchString", LookIn:=Database.Range("B:B"), _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
End With
With ActiveCell.Offset(0, 51)
Selection.PasteSpecial Paste:=xlPasteValues, operation:=xlNone, _
skipblanks:=False, Transpose:=False
Application.cutcopypaste = False
End With
ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:= _
"Letters.Browse.value", TextToDisplay:="Letter from Bank"
Letters.Hide
End Sub
Bookmarks