[vba]Dim mydate As Date
mydate = Date
mymonth = Left(mydate, 2)[/vba]
mydate = "8/10/2009"
mymonth = "8/"
Is there a way to force the month to have 2 numeral spaces (force a leading zero)?
[vba]Dim mydate As Date
mydate = Date
mymonth = Left(mydate, 2)[/vba]
mydate = "8/10/2009"
mymonth = "8/"
Is there a way to force the month to have 2 numeral spaces (force a leading zero)?
Office 2010, Windows 7
goal: to learn the most efficient way
Hi Tom,
If you are just looking for the Month Try:
[vba]
Dim mydate As Date
mydate = Date
mymonth = Month(mydate)
[/vba]
or depending on your needs
[vba]mymonth = Month(Date)[/vba]
I would do this:
[vba]
strMonth = IIf(Month(Date) < 10, "0" & CStr(Month(Date)), CStr(Month(Date)))
[/vba]
HTH
EDIT: Fixed an error Tommy
[VBA]mymonth = Format(mydate, "mm")[/VBA]
John Wilson
Microsoft PowerPoint MVP
Amazing Free PowerPoint Tutorials
http://www.pptalchemy.co.uk/powerpoi...tutorials.html
thanks guys. didn't have time to try it out today but i'll mark it solved.
Office 2010, Windows 7
goal: to learn the most efficient way
Heh, it seems I always try to do things the hard way. Thanks again.
Office 2010, Windows 7
goal: to learn the most efficient way