Hi;
I have an excel application of seven textboxes, asubmit button and a reset button on one sheet of a workbook. Another sheet has the data to be searched and another sheet will hold the results.
I can enter info on one textbox and after clicking the submit button the result will appear. My code for each textbox looks like:
If TextBox1.Value <> "" Then
strToFind = TextBox1.Value
Set wksToSearch = Sheet2
Set rngToSearch = wksToSearch.Range("F1").EntireColumn
Set wksToPaste = Sheet3
Set rngPaste = wksToPaste.Range("A1")
Set rngFound = rngToSearch.Find(strToFind, , , xlPart)
If Not rngFound Is Nothing Then
strFirstAddress = rngFound.Address
Do
rngFound.EntireRow.Copy rngPaste
Set rngFound = rngToSearch.FindNext(rngFound)
Set rngPaste = rngPaste.Offset(1, 0)
Loop Until rngFound.Address = strFirstAddress
End If
End If
If TextBox2.Value <> "" Then
strToFind = TextBox2.Value
Set wksToSearch = Sheet2
Set rngToSearch = wksToSearch.Range("G1").EntireColumn
Set wksToPaste = Sheet3
Set rngPaste = wksToPaste.Range("A1")
Set rngFound = rngToSearch.Find(strToFind, , , xlPart)
If Not rngFound Is Nothing Then
strFirstAddress = rngFound.Address
Do
rngFound.EntireRow.Copy rngPaste
Set rngFound = rngToSearch.FindNext(rngFound)
Set rngPaste = rngPaste.Offset(1, 0)
Loop Until rngFound.Address = strFirstAddress
End If
End If
And it continues for each of the remaining textboxes (textbox3 to textbox7). I want to be able to enter info on more than one textbox and retrieve all unique rows that match the criteria. For example, if I enter "Area1" in the location textbox , "Grumman" in the manufacturer textbox and "left wing" in the item description textbox; I want to get all of the unique rows that conatin these keywords in the respective columns. Any help is gretly appreciated.
I have an excel application of seven textboxes, asubmit button and a reset button on one sheet of a workbook. Another sheet has the data to be searched and another sheet will hold the results.
I can enter info on one textbox and after clicking the submit button the result will appear. My code for each textbox looks like:
If TextBox1.Value <> "" Then
strToFind = TextBox1.Value
Set wksToSearch = Sheet2
Set rngToSearch = wksToSearch.Range("F1").EntireColumn
Set wksToPaste = Sheet3
Set rngPaste = wksToPaste.Range("A1")
Set rngFound = rngToSearch.Find(strToFind, , , xlPart)
If Not rngFound Is Nothing Then
strFirstAddress = rngFound.Address
Do
rngFound.EntireRow.Copy rngPaste
Set rngFound = rngToSearch.FindNext(rngFound)
Set rngPaste = rngPaste.Offset(1, 0)
Loop Until rngFound.Address = strFirstAddress
End If
End If
If TextBox2.Value <> "" Then
strToFind = TextBox2.Value
Set wksToSearch = Sheet2
Set rngToSearch = wksToSearch.Range("G1").EntireColumn
Set wksToPaste = Sheet3
Set rngPaste = wksToPaste.Range("A1")
Set rngFound = rngToSearch.Find(strToFind, , , xlPart)
If Not rngFound Is Nothing Then
strFirstAddress = rngFound.Address
Do
rngFound.EntireRow.Copy rngPaste
Set rngFound = rngToSearch.FindNext(rngFound)
Set rngPaste = rngPaste.Offset(1, 0)
Loop Until rngFound.Address = strFirstAddress
End If
End If
And it continues for each of the remaining textboxes (textbox3 to textbox7). I want to be able to enter info on more than one textbox and retrieve all unique rows that match the criteria. For example, if I enter "Area1" in the location textbox , "Grumman" in the manufacturer textbox and "left wing" in the item description textbox; I want to get all of the unique rows that conatin these keywords in the respective columns. Any help is gretly appreciated.