Excel VBA: date format in user form

694 views Asked by At

I have various text boxes in a user form with dates pulled from my worksheets, but all the dates are in US format (m/d/yyyy).

I'm using the ControlSource property to copy the date, e.g.:

ControlSource='SKU Data'!N2

Is there a way to reformat the dates so they appear as d/m/yyyy?

The dates in the worksheets are already formatted to d/m/yyyy.

1

There are 1 answers

0
Gary's Student On

Do it with Strings:

Sub dural()
    txt = "12/25/2014"
    a = Split(txt, "/")
    txt = a(1) & "/" & a(0) & "/" & a(2)
    MsgBox txt
End Sub