Convert date to text without changing format dd/mm/yy

W

Wayne Wells

I have a bunch of dates, formated as mm/dd/yy. To export them to the program
I want to work on them with they need to be in text format.
If I do the format cells>number tab>text, it converts them to some long
string of digits along the lines of 39296, and so on.
How can I retain the mm/dd/yy format as text without hand typing each one?
 
G

Gary''s Student

Select the cells you want to convert and run this short macro:

Sub converttter()
Dim s As String
For Each r In Selection
s = r.Text
r.Clear
r.NumberFormat = "@"
r.Value = s
Next
End Sub
 
T

T. Valko

Use a helper column...

A1 = a true Excel date = 01/01/09

Enter this formula in B1:

=TEXT(A1,"mm/dd/yy")

Copy down as needed.

The formula will return the *TEXT* string 01/01/09

Then you can convert the formulas to constants...

Select the entire range of these formulas
Goto the menu Edit>Copy
Then, Edit>Paste Special>Values>OK
 
W

Wayne Wells

I figured it out via an example in this section that was something along
the lines of =TEXT(A1,"mm/dd/yy")
Then did a paste special>values and that brings me to my next question. The
cells all are in the correct text format but each and every one has an error
that shows
text as two digit date. Whoops, I figured out how to turn that off also.
Thanks for the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top