LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Find problem

Here's my Macro code (in part). All variables are DIMmed, their type is
indicated by the three letter prefix of the name.

strSearchItem = rngOuterCell.Value
Sheets("Earnings Balance 2003 Q4 Page 2").Select
Range("C3").Select
Range(Selection, Selection.End(xlDown)).Select
Set c = Selection.Find(What:=strSearchItem, LookIn:=xlValues)
If Not c Is Nothing Then
lngFoundRow = c.Row
GoTo Next1
End If

I have a collection of 8 WS, and if "c is Nothing", this process is repeated
with the next WS in the collection.

(Parenthetically, I have hard coded the WS name into an exact copy of the
above code, so I have 8 iteration of it. Messy, and it would be nice if I
could execute it in a loop that looks at each member of the Collection in
order -- but I don't know how to do it <g).

Here is the real problem: When I run this against my first strSearchItem,
the sought after target is in Row 3 of the WS, immediately below the two-row
header. However when I step through it, in this instance, lngFoundRow is
always 4 not 3. WHen I run the code against the next item in the source list,
and strSearchItem is not in Row 3, it returns what I consider to be the
"correct" value.

The only thing I can think of that has been done to the data throughout, is
that it was Sorted manually some small time ago. but prior to this.

I also tried the search using this:

(What:=strSearchItem, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)

And commenting out these:

'Range("C3").Select
'Range(Selection, Selection.End(xlDown)).Select

... same result.

Anyone got any ideas why I'm having this problem?
--
Dave
Temping with Staffmark
in Rock Hill, SC
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with 'Find' Dave Excel Discussion (Misc queries) 5 December 15th 09 01:27 PM
Find and Find Next problem Richard Hocking Excel Programming 2 September 13th 06 03:51 PM
Please help me find the problem with this Barb Reinhardt Excel Programming 1 August 29th 06 03:31 PM
find problem John Excel Programming 4 July 3rd 04 08:30 AM
find problem jon Excel Programming 2 May 24th 04 11:27 AM


All times are GMT +1. The time now is 02:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"