Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub TextToColumns()
- 'Deines Last Row
- Dim LastRow As Long
- LastRow = 1048576 'the last row possible in excel
- 'optional alternative **LastRow** Code
- 'Counts number of rows (counts from last row of Column A):
- 'Dim LastRow As Long
- 'LastRow = Cells(Rows.Count, "A").End(xlUp).Row
- 'Counts number of Columns (my headers start in row 1)
- Dim LastColumn As Long
- LastColumn = Cells(1, Columns.Count).End(xlToLeft).Column
- 'Loops Text to columns
- Dim StartingRow, StartingColumn As Long
- StartingRow = 1
- For StartingColumn = 1 To LastColumn
- Range(Cells(StartingRow, StartingColumn), Cells(LastRow, StartingColumn)).Select
- Selection.TextToColumns , DataType:=xlDelimited, _
- TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
- Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
- :=Array(1, 1), TrailingMinusNumbers:=True
- Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement