I have two datetimepickers and two combo boxes in userform Find. I want to be able to search sheet1 by any or all the datetimepickers and combo boxes. If there is a match in either of the fields, then I would like the row (in sheet 1) the contains the match to be copied and put on the next available row in sheet2. I will need for all matches to be put on sheet2. I have the following code in place, but I am stuck as to where to go now. It will look for matches on sheet 1 from one of the combo boxes and will copy and paste that one cell match into sheet2.
Private Sub btnSearch_Click()
Dim ws As Worksheet
Dim oFind, sFind As Range
searchTxt = Trim(cmbFindManufacturer.Value)
Set wb = ThisWorkbook
With wb
Set ws = .Worksheets("Sheet1")
End With
Set sFind = ws.Range("c1:c65500")
Set oFind = sFind.Find(What:=searchTxt, LookIn:=xlValues, LookAt:=xlWhole, SearchDirection:=xlNext, MatchCase:=False)
If Not oFind Is Nothing Then
oFind.Select
Selection.Copy
Sheet2.Activate
ActiveSheet.Paste
oFind.Deselect
Else
MsgBox "Manufacturer not found."
End If
End Sub
Any help to fix the code to what I need it to be, will be much appreciated.
Thanks
Jessica
Bookmarks