Hi there,
It's not easy to test this without access to your worksheet and UserForm, but try using the following code as a replacement for the code you've posted:
Dim sStringToFind As String
Dim rFoundCell As Range
Dim vColumn As Variant
sStringToFind = TextBox_IssueReference
If Trim(sStringToFind) <> vbNullString Then
For Each vColumn In Array("R", "V", "Z", "AD")
With Sheets("Daily Data").Range(vColumn & "2:" & vColumn & iLastRow)
Set rFoundCell = .Find(What:=sStringToFind, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rFoundCell Is Nothing Then
rFoundCell.Offset(0, 1) = CDate(TextBox_Date)
Else: MsgBox "Reference not found."
End If
End With
Next vColumn
End If
The highlighted values can be changed, deleted or added to as per your requirements.
It's also likely that this statement can be simplified to:
Set rFoundCell = .Find(What:=sStringToFind, _
LookIn:=xlValues, LookAt:=xlWhole)
Hope this helps - please let me know how you get on.
Regards,
Greg M
Bookmarks