Statement to ignore step if does not find text to Split

M

maperalia

How can I put a statement that if the macro does not find text to split when
I call text to column; just ignore it and continue with the program?
The problem is that I got the following message when the macro does not find
data:

Run-Time Error'1004':
No data was selected to parse

Then when I click debug it is highlighting at the following statement:

Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(1, 1)), TrailingMinusNumbers:=True

Thanks in advance.
Maperalia
 
T

Tom Ogilvy

On Error Resume Next
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(1, 1)), TrailingMinusNumbers:=True
On Error goto 0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top