Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to hide all rows that do not match a criteria in a specific
column. The criteria though is sometimes "hidden" in a text like blablakeywordblabla - in this case the keyword is given and should be identified regardless whether there is blabla around. The kleene stern method *keyword* does not work, I tried already the following: If Cells(x, 11).Value = "*erledigt*" Then Cells(x, 11).EntireRow.Hidden = True End If Does somebody know how I could do this? Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Test with Instr() method...
example Sub t() tmp = Cells(1, 1) If InStr("keyword", tmp) Then Debug.Print "Found" Else Debug.Print "Not found" End If End Sub Convert to UPPER if case does not matter... "Saladin Andreas" wrote: I would like to hide all rows that do not match a criteria in a specific column. The criteria though is sometimes "hidden" in a text like blablakeywordblabla - in this case the keyword is given and should be identified regardless whether there is blabla around. The kleene stern method *keyword* does not work, I tried already the following: If Cells(x, 11).Value = "*erledigt*" Then Cells(x, 11).EntireRow.Hidden = True End If Does somebody know how I could do this? Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Two things...
1) Uh, you have your arguments reversed... If InStr(tmp, "keyword") then 2) You don't need to use the UCase function (not the UPPER function; that is a worksheet function, not a VB one) to perform an case-insensitive search, InStr can do that via its optional arguments... If InStr(1, tmp, "keyword", vbTextCompare) then -- Rick (MVP - Excel) "Sheeloo" wrote in message ... Test with Instr() method... example Sub t() tmp = Cells(1, 1) If InStr("keyword", tmp) Then Debug.Print "Found" Else Debug.Print "Not found" End If End Sub Convert to UPPER if case does not matter... "Saladin Andreas" wrote: I would like to hide all rows that do not match a criteria in a specific column. The criteria though is sometimes "hidden" in a text like blablakeywordblabla - in this case the keyword is given and should be identified regardless whether there is blabla around. The kleene stern method *keyword* does not work, I tried already the following: If Cells(x, 11).Value = "*erledigt*" Then Cells(x, 11).EntireRow.Hidden = True End If Does somebody know how I could do this? Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use Like as the comparison, not =
If Cells(x, 11).Value Like "*erledigt*" Then Though your comparison would work in certain worksheet functions... HTH, Bernie MS Excel MVP "Saladin Andreas" wrote in message ... I would like to hide all rows that do not match a criteria in a specific column. The criteria though is sometimes "hidden" in a text like blablakeywordblabla - in this case the keyword is given and should be identified regardless whether there is blabla around. The kleene stern method *keyword* does not work, I tried already the following: If Cells(x, 11).Value = "*erledigt*" Then Cells(x, 11).EntireRow.Hidden = True End If Does somebody know how I could do this? Thanks |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Consider using the Like operator instead of the "equal" operator...
If Cells(x, 11).Value Like "*keyword*" Then -- Rick (MVP - Excel) "Saladin Andreas" wrote in message ... I would like to hide all rows that do not match a criteria in a specific column. The criteria though is sometimes "hidden" in a text like blablakeywordblabla - in this case the keyword is given and should be identified regardless whether there is blabla around. The kleene stern method *keyword* does not work, I tried already the following: If Cells(x, 11).Value = "*erledigt*" Then Cells(x, 11).EntireRow.Hidden = True End If Does somebody know how I could do this? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to evaluate string form of numeric expression in VBA? | Excel Programming | |||
regular expression parse string Perl $1 VBScript.RegExp | Excel Programming | |||
Find Row from MAX expression | Excel Programming | |||
Run/Execute string expression | Excel Programming | |||
Giving the String expression for Numeric Values.... | Excel Programming |