Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Converting text to yy/mm

I have a regular data that I import. Data that is input to column F comes in
as formatted as text with quotes around it ( i.e. "0601"). (If it helps, the
column to the right of this data is blank.) I have no control over the
imported formatting so it needs to be converted. This data should be
formatted as a date with yy/dd format. The resulting date from the initial
data would be 06/01 I need all the help I can get developing a macro that
will accomplish this.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Converting text to yy/mm

by yy/dd format, do you mean 06/34 would be Feb 3, 2006?

Please elaborate.

--
Regards,
Tom Ogilvy

"Billy B" wrote in message
...
I have a regular data that I import. Data that is input to column F comes
in
as formatted as text with quotes around it ( i.e. "0601"). (If it helps,
the
column to the right of this data is blank.) I have no control over the
imported formatting so it needs to be converted. This data should be
formatted as a date with yy/dd format. The resulting date from the initial
data would be 06/01 I need all the help I can get developing a macro that
will accomplish this.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Converting text to yy/mm

Tom,
Sorry, I screwed the date format up in my post. It should format yy/mm.

"Tom Ogilvy" wrote:

by yy/dd format, do you mean 06/34 would be Feb 3, 2006?

Please elaborate.

--
Regards,
Tom Ogilvy

"Billy B" wrote in message
...
I have a regular data that I import. Data that is input to column F comes
in
as formatted as text with quotes around it ( i.e. "0601"). (If it helps,
the
column to the right of this data is blank.) I have no control over the
imported formatting so it needs to be converted. This data should be
formatted as a date with yy/dd format. The resulting date from the initial
data would be 06/01 I need all the help I can get developing a macro that
will accomplish this.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Converting text to yy/mm

Sub FixData()
Dim s as String, s1 as String
for each cell in selection
s = replace(cell.value,chr(34),"")
s1 = right(s,2) & "/01/20" & lef(s,2)
cell.Value = dateValue(s1)
cell.Numberformat = "yy/mm"
Next
End Sub

Select the data and run the macro.

Test it on a copy of your data.


--
Regards,
Tom Ogilvy


"Billy B" wrote in message
...
Tom,
Sorry, I screwed the date format up in my post. It should format yy/mm.

"Tom Ogilvy" wrote:

by yy/dd format, do you mean 06/34 would be Feb 3, 2006?

Please elaborate.

--
Regards,
Tom Ogilvy

"Billy B" wrote in message
...
I have a regular data that I import. Data that is input to column F
comes
in
as formatted as text with quotes around it ( i.e. "0601"). (If it
helps,
the
column to the right of this data is blank.) I have no control over the
imported formatting so it needs to be converted. This data should be
formatted as a date with yy/dd format. The resulting date from the
initial
data would be 06/01 I need all the help I can get developing a macro
that
will accomplish this.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a text word or text string to a number Tom Excel Discussion (Misc queries) 6 January 2nd 09 08:23 PM
Converting a date to a text field w/o converting it to a julian da LynnMinn Excel Worksheet Functions 2 March 6th 08 03:43 PM
Converting text??? T Miller Excel Discussion (Misc queries) 5 October 20th 06 06:18 PM
converting numbers to text and prefill text field with 0's Jan Buckley Excel Discussion (Misc queries) 2 January 20th 05 09:03 PM
Converting text to value nicoll Excel Programming 1 November 14th 03 06:11 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"