Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,388
Default Help: Text to Columns & MDY

Hi Everyone,

I'm trying to do the following in VB.

Data TextToColumns Delimited 'Delimiters Doesn't Matter' Column Data
Format = Date: MDY.

I recorded a macro manually doing this and came up with the following:


Code:
Columns("A:A").TextToColumns Destination:=Range("A1"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=True, Comma:=True, Space:=False, Other:=True, OtherChar:= _
",", FieldInfo:=Array(1, 3), TrailingMinusNumbers:=True

This works when I do it manually, but not when part of a macro.

Can anyone help?

Thanks
Dave

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Help: Text to Columns & MDY

If column A has a list of dates in text form that you want to convert to
"real" dates, then:

Sub dave()
Set r = Intersect(Range("A:A"), ActiveSheet.UsedRange)
For Each rr In r
On Error Resume Next
rr.Value = DateValue(rr.Value)
skipit:
Next
End Sub
--
Gary''s Student - gsnu200750


"Dave" wrote:

Hi Everyone,

I'm trying to do the following in VB.

Data TextToColumns Delimited 'Delimiters Doesn't Matter' Column Data
Format = Date: MDY.

I recorded a macro manually doing this and came up with the following:


Code:
Columns("A:A").TextToColumns Destination:=Range("A1"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=True, Comma:=True, Space:=False, Other:=True, OtherChar:= _
",", FieldInfo:=Array(1, 3), TrailingMinusNumbers:=True

This works when I do it manually, but not when part of a macro.

Can anyone help?

Thanks
Dave

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Help: Text to Columns & MDY

Your code works for me.

What happens or doesn't happen when you run the macro?


Gord Dibben MS Excel MVP

On Tue, 23 Oct 2007 06:23:01 -0700, Dave wrote:

Hi Everyone,

I'm trying to do the following in VB.

Data TextToColumns Delimited 'Delimiters Doesn't Matter' Column Data
Format = Date: MDY.

I recorded a macro manually doing this and came up with the following:


Code:
Columns("A:A").TextToColumns Destination:=Range("A1"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=True, Comma:=True, Space:=False, Other:=True, OtherChar:= _
",", FieldInfo:=Array(1, 3), TrailingMinusNumbers:=True

This works when I do it manually, but not when part of a macro.

Can anyone help?

Thanks
Dave


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
Combining Text from 2 Columns into 1 then Deleting the 2 Columns sleepindogg Excel Worksheet Functions 5 September 19th 08 12:36 AM
help with sorting text in columns to match other columns rkat Excel Discussion (Misc queries) 1 August 11th 06 03:42 AM
merge text from 2 columns into 1 then delete the old 2 columns sleepindogg Excel Worksheet Functions 4 March 30th 06 07:25 PM
Excel is automatically doing "text to columns" upon paste text. robert10000 Excel Discussion (Misc queries) 1 June 15th 05 07:49 PM
Linking text columns with text and data columns Edd Excel Worksheet Functions 0 March 17th 05 04:23 PM


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

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

About Us

"It's about Microsoft Excel"