Requirement:
The user has a column with some text that represents dates in the format "yy-mm-dd" and needs to convert the format to "dd/mm/yyyy" but I'm stumped.
https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/1202889-converting-date-format
Solution:
Sub ConvertYMDTextToDMYDate() Dim rngWithTextInYYMMDDFormat As Range Set rngWithTextInYYMMDDFormat = Worksheets("Name Of Your Sheet").Range("A2:A27") With rngWithTextInYYMMDDFormat .TextToColumns Destination:=.Cells(1), FieldInfo:=Array(1, 5) .NumberFormat = "DD/MM/YYYY" End With End Sub
Obtained from the OzGrid Help Forum.
Solution provided by S M C.
See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets
See also:
How to use a code to display the current date based on certain criteria |
How to set dynamic dates for pivot table grouping |
How to use VBA code to obtain date from cell, then calculate 3 months later |
How to create VBA code to compare dates |
Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.