LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
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: ---
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
reduce excel file size by deleting blank rows and columns?? Delta007bhd Excel Discussion (Misc queries) 5 April 4th 23 12:48 PM
easy script for deleting blank columns GaiGauci Excel Programming 3 November 11th 09 03:28 AM
Deleting blank rows which contain blank drop-down list boxes Al Excel Programming 3 February 18th 09 01:37 PM
Deleting blank cells w/o impacting other rows/columns ShagNasty Excel Programming 5 October 26th 08 04:34 PM
Newbee - deleting blank columns Rednosebob Excel Programming 5 March 29th 06 03:55 AM


All times are GMT +1. The time now is 09:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"