Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the below code to search and copy the rows that matched some
criteria.. I want to add one more search criteria to this code which checks for matching words.. something like below line.. (Sheets("Details").Range("B" & lngRow) = .Range("G2") Or Len(.Range("G2").Value) = 0) But the thing is the word entered may not be the full word Eg., Range("G2") = "it" Then it should check for words that contains "it".. Like profitless sit out Italy my code -------------------------------- lngLastRow = Sheets("Details").Cells(Rows.Count, "B").End(xlUp).Row lngNewRow = Sheets("Search").Cells(Rows.Count, "A").End(xlUp).Row + 1 With Sheets("Search") Select Case UCase(.Range("C2")) Case "FIRST", "": TheCol = "I": TheCol1 = "J" Case "SECOND": TheCol = "L": TheCol1 = "M" Case "FINAL": TheCol = "N" Case Else 'the default/error option 'TheCol = "J" MsgBox "Check cell C2 on the Search sheet" Exit Sub End Select For lngRow = 1 To lngLastRow If (Sheets("Details").Range("H" & lngRow) Date - 90 Or Len(.Range("E4").Value) = 0) And _ (Sheets("Details").Range("F" & lngRow) = .Range("E2") Or Len(.Range("E2").Value) = 0) And _ (Sheets("Details").Range("E" & lngRow) = .Range("E6") Or Len(.Range("E6").Value) = 0) And _ (Sheets("Details").Range(TheCol & lngRow) = .Range("C4") Or Len(.Range("C4").Value) = 0) And _ (Sheets("Details").Range(TheCol1 & lngRow) = .Range("C6") Or Len(.Range("C6").Value) = 0) Then varTemp = Sheets("Details").Range(lngRow & ":" & lngRow) Sheets(4).Range(lngNewRow & ":" & lngNewRow) = varTemp lngNewRow = lngNewRow + 1 End If Next End With |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
search option for linked data | Excel Discussion (Misc queries) | |||
Where is advanced search option? | Excel Discussion (Misc queries) | |||
Search and replace option in graphs | Charts and Charting in Excel | |||
how do i create search option in ecxel | Excel Programming | |||
Search option | Excel Programming |