Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there simple way to use "find" to search for more than one string? i.e.
find "b" or find "s", without running separate a "find" code for each string. this doesn't work, but explains what I want to do: .find(what:="b" or "s") thanks again. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nope and there would be no real point to it. The find function finding all
instances of B and then finding all of the instances of S would be the same as finding all of the instaces of B or S. It would not be any more efficient one way or the other becuase the find has to do the exact same amount of work finding all instances of B and all instance of S. -- HTH... Jim Thomlinson "nathan" wrote: Is there simple way to use "find" to search for more than one string? i.e. find "b" or find "s", without running separate a "find" code for each string. this doesn't work, but explains what I want to do: .find(what:="b" or "s") thanks again. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to keep the code writing effecient, clear and down to a minimum.
thanks. "Jim Thomlinson" wrote: Nope and there would be no real point to it. The find function finding all instances of B and then finding all of the instances of S would be the same as finding all of the instaces of B or S. It would not be any more efficient one way or the other becuase the find has to do the exact same amount of work finding all instances of B and all instance of S. -- HTH... Jim Thomlinson "nathan" wrote: Is there simple way to use "find" to search for more than one string? i.e. find "b" or find "s", without running separate a "find" code for each string. this doesn't work, but explains what I want to do: .find(what:="b" or "s") thanks again. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
no. But then how hard is it to put the strings in an array and loop through
the strings? Regards, Tom Ogilvy "nathan" wrote in message ... Is there simple way to use "find" to search for more than one string? i.e. find "b" or find "s", without running separate a "find" code for each string. this doesn't work, but explains what I want to do: .find(what:="b" or "s") thanks again. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
if that is a way to do it, then that is what I am looking for help on. looks
like john showed an example of that. thanks. "Tom Ogilvy" wrote: no. But then how hard is it to put the strings in an array and loop through the strings? Regards, Tom Ogilvy "nathan" wrote in message ... Is there simple way to use "find" to search for more than one string? i.e. find "b" or find "s", without running separate a "find" code for each string. this doesn't work, but explains what I want to do: .find(what:="b" or "s") thanks again. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nathan
try something like this... Dim rngToSearch As Range Dim wks As Worksheet Dim rngFound As Range Dim WhatToFind As Variant Dim iCtr As Long Dim DestCell As Range Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Set wks = Sheets("sheetname") Set rngToSearch = wks.Columns(6) WhatToFind = Array("1", "2", "3") For iCtr = LBound(WhatToFind) To UBound(WhatToFind) With rngToSearch Set rngFound = .Cells.Find(what:=WhatToFind(iCtr), _ LookIn:=xlValues, lookat:=xlWhole, _ after:=.Cells(.Cells.Count), _ MatchCase:=False) Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic "nathan" wrote: Is there simple way to use "find" to search for more than one string? i.e. find "b" or find "s", without running separate a "find" code for each string. this doesn't work, but explains what I want to do: .find(what:="b" or "s") thanks again. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks.
"John" wrote: Nathan try something like this... Dim rngToSearch As Range Dim wks As Worksheet Dim rngFound As Range Dim WhatToFind As Variant Dim iCtr As Long Dim DestCell As Range Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Set wks = Sheets("sheetname") Set rngToSearch = wks.Columns(6) WhatToFind = Array("1", "2", "3") For iCtr = LBound(WhatToFind) To UBound(WhatToFind) With rngToSearch Set rngFound = .Cells.Find(what:=WhatToFind(iCtr), _ LookIn:=xlValues, lookat:=xlWhole, _ after:=.Cells(.Cells.Count), _ MatchCase:=False) Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic "nathan" wrote: Is there simple way to use "find" to search for more than one string? i.e. find "b" or find "s", without running separate a "find" code for each string. this doesn't work, but explains what I want to do: .find(what:="b" or "s") thanks again. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Finding multiple data values in a column | Excel Worksheet Functions | |||
finding multiple non-zero values in a column | Excel Worksheet Functions | |||
finding multiple non-zero values in a column | Excel Worksheet Functions | |||
Finding multiple values of a function | Excel Worksheet Functions | |||
Finding (Multiple) Highest Values in Column | Excel Worksheet Functions |