Macro delimiting text if column has value

B

Beverly76

This is my macro, it goes column by column A - AZ delimiting text. The
problem I have is that I get an error message on the first column which is
empty.

After column A, is there a way to say if B1 is null, end macro before moving
on to delimit Text in Column B?

I want to make this macro available to other users but the error message is
a problem.

Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False,
FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Columns("B:B").Select
Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False,
FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
 
D

Dave Peterson

Your code does data|text to columns|delimited by tab on column A.

Doesn't that mean that all the stuff in column A now is parsed into B:xxx based
on tab characters?

And the stuff in column B won't have any tab characters there at all.

Is that what you're doing or am I missing something?
 
B

Beverly76

It is more of a procedural step to make sure all the text is where it is
supposed to be, where it appears to be.

It is probably redundant. But what I really want at this point is the code
to interrupt the macro if a cell is blank.
--
Sincerely,
Beverly76


Dave Peterson said:
Your code does data|text to columns|delimited by tab on column A.

Doesn't that mean that all the stuff in column A now is parsed into B:xxx based
on tab characters?

And the stuff in column B won't have any tab characters there at all.

Is that what you're doing or am I missing something?
 
D

Dave Peterson

Option Explicit
Sub testme01()

Dim iCol As Long

With ActiveSheet

iCol = 1
Do
If iCol > .Columns.Count Then
Exit Do
End If
If IsEmpty(.Cells(1, iCol).Value) Then
Exit Do
End If

With .Columns(iCol)
.TextToColumns Destination:=.Cells(1), _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=True, Semicolon:=False, Comma:=False, _
Space:=False, Other:=False, _
FieldInfo:=Array(1, 1), TrailingMinusNumbers:=True
End With
iCol = iCol + 1
Loop
End With

End Sub





It is more of a procedural step to make sure all the text is where it is
supposed to be, where it appears to be.

It is probably redundant. But what I really want at this point is the code
to interrupt the macro if a cell is blank.
 

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