![]() |
Statement to ignore step if does not find text to Split
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 |
Statement to ignore step if does not find text to Split
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 -- Regards, Tom Ogilvy "maperalia" wrote: 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 |
Statement to ignore step if does not find text to Split
Tom;
Thanks you very much it is working perfectly!!!!! Kind regards Maperalia "Tom Ogilvy" wrote: 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 -- Regards, Tom Ogilvy "maperalia" wrote: 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 |
All times are GMT +1. The time now is 07:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com