Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent Find with Dates Question

Status
Not open for further replies.

robcarr

Programmer
May 15, 2002
633
GB
Dear All,

I am again hitting my head against the wall with this simple bit of coding,

Sub get_Bang_data()
Dim sourcedate As Date
Dim ddate As Date


Sheets(1).Select
dname = [c3].Value
fname = [c4].Value
sourcedate = Range("c1").Value
ddate = Range("c2").Value

I am trying to get ddate value to = dddd, sourcedate works fine and formats the date as dd/mm/yy, but i get a type mismatch error on ddate, I am using the sourcedate and ddate in a find, and for the find to work, the variable needs to bet set with out the quotes("") around the value, sourcedate does this fine this way, but I can not get ddate to go pass the last line of coding above, is there another way to do this, the values in c1 and c2 are entered via a calendar, they are identical just i need the formats to be different(dd/mm/yy - sourcedate, dddd = ddate, both have to end up with out quotes around). I am getting quite frustrated with this.

any help greatly appreciated, coding for find is below if it helps.

Set myrange = Rows("5:6")
myrange.Find(What:=sourcedate, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False).Activate

any quick response would be greatly appreciated.



Thanks Rob.[yoda]
 
i sorted this out, the range the find was searching needed to be formatted as text, and this now works fine.

Thanks Rob.[yoda]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top