Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

STL - Formerly Best Training Solutions Through Learning
TrustPilot
Excellent
Request Callback We will call you back
0207 987 3777 Call for assistance
Your Basket Basket is empty
date manipulation

ResolvedVersion 2003

Michael has attended:
Excel VBA Advanced course

Date Manipulation

Is there a ready macro to check the format of the date, and if in US format, convert into British date format? Thanks

RE: Date Manipulation

Hi Michael

Thanks for the question. The following function chops up the date into day, month and year and then arranges it into UK format

Public Function DateConverter(USDate As String) As Date

Dim strMonth As String
Dim strDay As String
Dim strYear As String
Dim strDate As String

strDay = DatePart("d", USDate)
strMonth = DatePart("m", USDate)
strYear = DatePart("yyyy", USDate)

strDate = strDay & "/" & strMonth & "/" & strYear

DateConverter = CDate(strDate)


End Function


I hope this helps

Stephen

Thu 30 Jun 2011: Automatically marked as resolved.

Excel tip:

Outlining - ungrouping rows or columns

Highlight want you want to ungroup and press ALT + SHIFT + right cursor arrow

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.