Solved

Excel VBA Text to Columns

Posted on 2014-04-07
2
440 Views
Last Modified: 2014-04-07
I need to format multiple Columns A,D,I,L Text to Columns on all worksheets except for 2 (Invoice and Summary).

Text to Column Parameters:
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
 Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
  :=Array(1, 1), TrailingMinusNumbers:=True
0
Comment
Question by:shieldsco
2 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 500 total points
Comment Utility
You can try this code, looping through the sheets and the columns:

Sub Macro1()
'
Dim shtLoop As Worksheet


For Each shtLoop In ActiveWorkbook.Worksheets

    If shtLoop.Name <> "Invoice" And shtLoop.Name <> "Summary" Then
           T2C shtLoop.[a1]
           T2C shtLoop.[D1]
           T2C shtLoop.[I1]
           T2C shtLoop.[L1]
    End If

Next shtLoop

End Sub

Private Sub T2C(rg As Range)

If Application.WorksheetFunction.CountA(rg.EntireColumn) Then _
    rg.EntireColumn.TextToColumns Destination:=rg, DataType:=xlDelimited, _
    TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
      :=Array(1, 1), TrailingMinusNumbers:=True
End Sub

Open in new window


Thomas
0
 

Author Closing Comment

by:shieldsco
Comment Utility
Works Good -- Thanks
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now