PDA

View Full Version : cells.find ....need help!



wolf.stalker
11-11-2008, 11:02 PM
hey all. i am having a pickle of a time trying to make this work....i need to find a date that is between E2:BG2. (note two things. E2=10/27/2008 and then G2=E2+1; I2=G2+1; etc. also...each date is merged between two cells. so the first one E2 actually is E2:F2...if that helps.

now, i have looked around and tried to figure this out, but i have got to be missing something. I can use this....


Cells.Find(What:="chico", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=False) _
.Activate


and it puts me on cell A121 (which is where part of that word resides) but I can NOT get it to find my date.!

anyone able to help me out a bit?

Bob Phillips
11-12-2008, 02:11 AM
I must be missing something, but if you want to find a date, why are you lokking for chico?

wolf.stalker
11-12-2008, 04:49 AM
I must be missing something, but if you want to find a date, why are you lokking for chico?

chico was what i was using to "test" the routine out with. it worked. i just couldn't get it to find a date on my sheet.

i later realized that perhaps the problme was the Catagory. After i changed my dates (on my worksheets) to string values, I was able to search for it....but now i have hit another snag..i will continue to work on it....i am close i know i am :-D

Bob Phillips
11-12-2008, 06:23 AM
Try real dates and search for CLng(lookup_date)

david000
11-13-2008, 12:16 AM
I ran this on merged cells, and cells with 'center across section' and it works fine.

Sub test()
Dim r As Range
Dim d As Range
Dim dt As Date

dt = Application.InputBox("Enter a date", , , , , , , 1)
Set r = Range("e2:bg2")

Set d = r.Find(dt, , , SearchOrder:=xlByColumns)
If Not d Is Nothing Then

d.Select

End If
End Sub