date manipulation

TrustPilot

starstarstarstarstar Excellent

  • Home
  • Courses
  • Promotions
  • Schedule
  • Formats
  • Our Clients

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Date Manipulation

Date Manipulation

resolvedResolved · High Priority · Version 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:

Create Charts with One keystroke

Create a graph with one click

1. Select your data.
2. Press F11.
3. You have a graph.

View all Excel hints and tips


Server loaded in 0.05 secs.