View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default I think I'm missing something very simple

You might want to eliminate all the selections:

Public Sub Parse()
Dim ws As Worksheet
Application.DisplayAlerts = False
For Each ws In Worksheets
ws.Columns(1).TextToColumns _
DataType:=xlDelimited, _
ConsecutiveDelimiter:=True, _
Tab:=False, _
Semicolon:=False, _
Comma:=False, _
Space:=True
Next ws
Application.DisplayAlerts = True
For Each ws In Worksheets
With ws.Range("A1:A2")
If Application.CountA(.Cells) < 2 Then _
.EntireColumn.Delete
End With
Next ws
End Sub


In article .com,
"DanQAEngineer" wrote:

Finally, because I like portable script and can never leave well enough
alone:

Sub Parse()
For Each ws In Worksheets
Application.DisplayAlerts = False
ws.Columns(1).TextToColumns DataType:=xlDelimited, _
ConsecutiveDelimiter:=True, Tab:=False, Semicolon:=False, _
Comma:=False, Space:=True
Next ws
Application.DisplayAlerts = True
i = 1
For Each ws In Worksheets
Sheets("Sheet" & i).Activate
Range(Cells(1, 1), Cells(2, 1)).Select
For Each MyCell In Selection
If MyCell.Value Like "" Then
Columns(1).Delete
End If
Next
i = i + 1
Next ws
End Sub