ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   date find using find method (https://www.excelbanter.com/excel-programming/348721-date-find-using-find-method.html)

x taol

date find using find method
 


there are dates in Column A.
dateTest
2005-04-02
2005-04-17
2005-07-08
2005-12-11

then, i want to find 2005 and april only.
thus i coding below.
sub test()
set rFnd = range(cells(1),cells(1).end(xldown))
set cFnd = r.find("2005-04",r(1),xlformulas,2)
end sub

but cFnd have nothing..... why, why....????
help me.

*** Sent via Developersdex http://www.developersdex.com ***

Toppers

date find using find method
 
Hi,
This worked OK for me:

Sub findDates()
With Worksheets(1).Range("a1:a5")
Set c = .Find("2005-04", LookIn:=xlValues, Lookat:=xlPart)
If Not c Is Nothing Then
firstAddress = c.Address
Do
MsgBox c.Row
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Sub

"x taol" wrote:



there are dates in Column A.
dateTest
2005-04-02
2005-04-17
2005-07-08
2005-12-11

then, i want to find 2005 and april only.
thus i coding below.
sub test()
set rFnd = range(cells(1),cells(1).end(xldown))
set cFnd = r.find("2005-04",r(1),xlformulas,2)
end sub

but cFnd have nothing..... why, why....????
help me.

*** Sent via Developersdex http://www.developersdex.com ***


x taol

date find using find method
 

no, the source do not work.
currently , i use excel 2000.


*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 10:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com