Sub TestTextToColumns()
Dim rg As Range
Set rg = ThisWorkbook.Worksheets("Text to Columns").Range("a20").CurrentRegion
CSVTextToColumns rg, rg.Offset(15, 0)
CSVTextToColumns rg
Set rg = Nothing
End Sub
Sub CSVTextToColumns(rg As Range, Optional rgDestination As Range)
If IsMissing(rgDestination) Or rgDestination Is Nothing Then
rg.TextToColumns , xlDelimited, , , , , True
Else
rg.TextToColumns rgDestination, xlDelimited, , , , , True
End If
End Sub
|