ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Convert date to text without changing format dd/mm/yy (https://www.excelbanter.com/excel-discussion-misc-queries/216556-convert-date-text-without-changing-format-dd-mm-yy.html)

Wayne Wells

Convert date to text without changing format dd/mm/yy
 
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 cellsnumber tabtext, 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?


Gary''s Student

Convert date to text without changing format dd/mm/yy
 
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
--
Gary''s Student - gsnu200826


"Wayne Wells" wrote:

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 cellsnumber tabtext, 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?


T. Valko

Convert date to text without changing format dd/mm/yy
 
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 EditCopy
Then, EditPaste SpecialValuesOK

--
Biff
Microsoft Excel MVP


"Wayne Wells" wrote in message
...
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 cellsnumber tabtext, 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?




Wayne Wells

Convert date to text without changing format dd/mm/yy
 
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 specialvalues 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.
"Gary''s Student" wrote:

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
--
Gary''s Student - gsnu200826


"Wayne Wells" wrote:

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 cellsnumber tabtext, 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?



All times are GMT +1. The time now is 01:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com