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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CLng on a Date variable giving Type Mismatch error

Status
Not open for further replies.
Apr 27, 2006
126
GB
The following comes up with a type mismatch error when on the last line:

-----------------------------------------------------
repform = ActiveCell.Value & "/" & Sheet4.Cells(13, 2) & "/" & Format(Sheet4.Cells(13, 3), "00")

repform = Format(repform, "dd/mm/yyyy")

sheetdate = CLng(repform) <-- error
-----------------------------------------------------

in the immediate window:
?repform
31/10/2006

the variable isn't declared as anything else so am not sure what is going wrong.

________
clueless
 
I fixed it with:

repform = Format(repform, "0")

MADNESS

________
clueless
 



FYI...

Why do Dates and Times seem to be so much trouble? faq68-5827

Skip,

[glasses] [red][/red]
[tongue]
 
Another way:
repform = CDate(ActiveCell.Value & "/" & Sheet4.Cells(13, 2) & "/" & Format(Sheet4.Cells(13, 3), "00"))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top