Hello,
is't any vba code to return any date to day first.
example :
01/03/2006 to 01/03/2006
05/03/2006 to 01/03/2006
11/04/2006 to 01/04/2006
Thanks,
Hello,
is't any vba code to return any date to day first.
example :
01/03/2006 to 01/03/2006
05/03/2006 to 01/03/2006
11/04/2006 to 01/04/2006
Thanks,
Mohd Azrie
Bt Pahat, Johor, Malaysia.
This may help. Actually, it's designed to work as a worksheet function, but if you change the input parameter to date or string type, you can use it in regular code. You might have to alter it a little, (i.e. change the order of day, month, year) depending on how your system handles date.
[vba] Function ReduceDate(cell As Range) As Date
Dim a As String
a = "1/" & CStr(Month(cell.Value)) & "/" & CStr(Year(cell.Value))
ReduceDate = CDate(a)
End Function[/vba]
-------------------------------------------------
The more details you give, the easier it is to understand your question. Don't save the effort, tell us twice rather than not at all. The amount of info you give strongly influences the quality of answer, and also how fast you get it.
Hmm... I just receive interesting solution could be share to others,
CurDate = Date
NewDate = DateAdd("d",-(Day(CurDate)-1),CurDate)
I'ts works .
Mohd Azrie
Bt Pahat, Johor, Malaysia.
You don't need DateAdd
[vba]
CurDate = Date
NewDate = CurDate - Day(CurDate) + 1
[/vba]