Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All -
I'm building a function to do a find. the "A" code below works. The "B" code does NOT, yet it's closer to MSo example. I can't see the diff. Help? "B" would be more efficient, yes ? Thanks. Function zFinds_ByRin1C(Ws As Worksheet, sLookFor As String, _ Col As Integer, FmRow As Long, ToRow As Long, _ bXlWhole As Boolean) As Long Dim It As Range, WhoOrPrt If bXlWhole = True Then WhoOrPrt = xlWhole Else WhoOrPrt = xlPart If FmRow < 1 Then FmRow = 1 If ToRow < 1 Or ToRow MSoMaxRow Then ToRow = MSoMaxRow With Ws ' A start Set It = .Range(.Cells(FmRow, Col), .Cells(ToRow, Col)) _ .Find(sLookFor, LookIn:=xlValues, LookAt:=WhoOrPrt) End With ' A end ' B start returns not found 0 value with same data in the worksheet. 'With Ws.Range(Cells(FmRow, Col), Cells(ToRow, Col)) ' Set It = .Find(sLookFor, LookIn:=xlValues, LookAt:=WhoOrPrt) 'End With ' B end If Not It Is Nothing Then zFinds_ByRin1C = It.Row End Function -- Neal Z |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple If Stmts | Excel Discussion (Misc queries) | |||
Nested 'If" stmts | Excel Discussion (Misc queries) | |||
Creating macros with if stmts | Excel Discussion (Misc queries) | |||
Monthly bank stmts | Excel Worksheet Functions | |||
simplify SUMIF stmts | Excel Programming |