View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Charles C[_3_] Charles C[_3_] is offline
external usenet poster
 
Posts: 1
Default Deleting blank columns


StackemEvs;739887 Wrote:

Hi, I want a very simple couple of lines which checks if the cells in
the first column is blank (which means it has been added by mistake) and
deletes it out. Just checking the first cell is enough. Examples I've
tried a



VBA Code:
--------------------


'Check if Column A blank
If wksDataSheet.Cells(Cells(1, 1)) Like " " Then
Selection.nrows(1).EntireRow.Delete
Else
End If

If wksDataSheet.CountA(.Columns(nRow, 1)) = 0 Then
.Columns(nRow, 1).EntireColumn.Delete
End If

If Application.CountA(.Columns(A)) = 0 Then
.Columns(A).EntireColumn.Delete
End If

--------------------




Thanks






VBA Code:
--------------------



Sub DeleteBlankColA()

Dim x As Integer 'Minimun row to check
Dim x1 As Integer

x1 = 1
For x = 1 To 2000
If Len(Trim(Cells(x1, 1))) < 1 Then
Rows(x1).Delete
x1 = x1 - 1
End If
x1 = x1 + 1
Next x

End Sub

--------------------




Charles
'Opener Consulting Home' (http://www.openerconsulting.com)


--
Charles C
------------------------------------------------------------------------
Charles C's Profile: http://www.thecodecage.com/forumz/member.php?u=89
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=207689

http://www.thecodecage.com/forumz


--- news://freenews.netfront.net/ - complaints: ---