Recorded VBA Text to Columns performs differently

Harsh210

New Member
Joined
Mar 23, 2022
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hi All,
I recorded the following macro:

VBA Code:
Sub TtoC()
'
' TtoC Macro
'

'
    Columns("Q:Q").Select
    Application.CutCopyMode = False
    Selection.TextToColumns Destination:=Range("Q1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 4), TrailingMinusNumbers:=False
      
End Sub

Upon running the recorded macro on a copy of the raw data, I get a different output.

The result of the action was as follows:
Accounting Period - Raw dataAccounting Period - After Manual Text to Columns
Accounting Period - After VBA Text to Columns
Feb-221/02/202222/02/2022
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Did you already check your unit's region and/or language settings? It might help.
If the problem still persist would you be kind enough to at least give us a sample of your data in xl2bb so that other online member can see the problem and eventually help you...
 
Upvote 0
VBA seems to work differently in macro vs manual. It appears that in the manual function, it's recognising your data as "mmm-yy", while the USA-centric VBA is seeing it as "mmm-dd". Which is correct?
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,178
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top