urdearboy
urdearboy

Reputation: 14580

Excel-VBA - Format data in Column to Delimited

Need help making Col D "Delimited" from cell D2 to the last cell in Col D that is not blank. I used the Record Macro to try to just steal the code but it does not seem to be working. Can anybody explain how to edit this code so that it will work or provide a new code that does what I am asking.

Sub Delimit ()
Selection.TextToColumns Destination:=Columns("D"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
End Sub

Upvotes: 0

Views: 4374

Answers (1)

Kyle
Kyle

Reputation: 2545

Sub Delimit()
With Workbooks("Workbook Name")
    With .Sheets("Your Sheet Name Here")
       .Range("d2:" & .Range("d" & .Rows.Count).End(xlUp).Address).TextToColumns Destination:=.Range("D2"), DataType:=xlDelimited, _
         TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
         Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
         :=Array(1, 1), TrailingMinusNumbers:=True
    End With
End With
End Sub

Upvotes: 2

Related Questions