Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
reduce excel file size by deleting blank rows and columns?? | Excel Discussion (Misc queries) | |||
easy script for deleting blank columns | Excel Programming | |||
Deleting blank rows which contain blank drop-down list boxes | Excel Programming | |||
Deleting blank cells w/o impacting other rows/columns | Excel Programming | |||
Newbee - deleting blank columns | Excel Programming |