Thread
:
Deleting a row
View Single Post
#
9
Posted to microsoft.public.excel.programming
Mike Fogleman
external usenet poster
Posts: 1,092
Deleting a row
Don, this will work if there is only one space in the cell. What if there
are two or more. My code, although not as compact as yours, will compare the
number of spaces to the length of the text, and if they are equal, no matter
how many there are, it will delete the row.
Sound reasonable? If the length is 0 then it will immediately delete the row
without testing for spaces.
Mike F
"Don Guillett" wrote in message
...
try this to get spaces and blanks
Sub deleteallblanks()
For i = Cells(Rows.Count, "c").End(xlUp).Row To 2 Step -1
If Cells(i, "c") = " " Or Cells(i, "c") = "" Then Rows(i).Delete
Next i
End Sub
--
Don Guillett
SalesAid Software
"Neal" wrote in message
...
I tried it and nothing happened!
"Don Guillett" wrote:
try
Sub RowBeGone()
Columns("c").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
End Sub
--
Don Guillett
SalesAid Software
"Neal" wrote in message
...
How would I write the code to delete a row depending on if a certain
cell
is
blank?
If e1 is blank delete row 1 and so on.
range("C").Select
do
row.Delete Shift:=xlUp
loop until isempty(activecell<" ")
Or something like this? I would greatly appreciate the help. Thanks
Neal.
Reply With Quote
Mike Fogleman
View Public Profile
Find all posts by Mike Fogleman