ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,226
- Office Version
- 2007
- Platform
- Windows
Hi,
I have the working code supplied below but because of an issue on my worksheet i now need to use this in a userform.
The userform will just be a command button & should it be two text box i need to use ?
Can you advise please how i would now use the code shown below but from the userform.
Thanks
I have the working code supplied below but because of an issue on my worksheet i now need to use this in a userform.
The userform will just be a command button & should it be two text box i need to use ?
Can you advise please how i would now use the code shown below but from the userform.
Thanks
VBA Code:
Private Sub SearchReplaceButton_Click()
Dim lRow As Long, rng As Range, f As Range
With Worksheets("HONDA LIST")
lRow = .Cells(.Rows.Count, 2).End(xlUp).Row
Set rng = .Range("B4:B" & lRow)
Set f = rng.Find(.Cells(5, 13).Value, , xlValues, xlWhole)
If f Is Nothing Then
MsgBox .Cells(5, 13).Value & " Was Not Found, Please Try Again", vbCritical, "UPDATE VEHICLE INFO MESSAGE"
Range("M5:N5").ClearContents
Else
rng.Replace What:=.Cells(5, 13).Value, Replacement:=.Cells(5, 14).Value, _
LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False
MsgBox "WORKSHEET UPDATED SUCCESSFULLY", vbInformation, "UPDATE VEHICLE INFO MESSAGE"
End If
.Cells(4, 1).Select
Range("M5:N5").ClearContents
End With
End Sub