Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.
Sheets("COOIS-Done").Select
If (D4 = "") Then 'if blank? do TextToColumns
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="|", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, _
1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12 _
, 1), Array(13, 1), Array(14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1), _
Array(19, 1)), TrailingMinusNumbers:=True
'if not continue
End If
Sheets("COOIS-Done").Select
If Range("A2") = "*|*" Then 'if cell A2 contains the character | do TextToColumns
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="|", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, _
1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12 _
, 1), Array(13, 1), Array(14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1), _
Array(19, 1)), TrailingMinusNumbers:=True
'if not continue
End If
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
The if statement in your code is not even valid.
Open in new window
is not in the correct format at all. You should not be able to run the macro at all.It should be
Open in new window
One other problem, are you sure D4 is ""? When you extract data from a CSV or TSV file, it's very often that a cells appears to be blank but in fact not. Is there any space sitting in the cell? Is there any invisible characters sitting in the cell?