Thread
:
Deleting a row
View Single Post
#
10
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
Deleting a row
I think OP said "blank" so it's unlikely there would be more than one space.
--
Don Guillett
SalesAid Software
"Mike Fogleman" wrote in message
...
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
Don Guillett
View Public Profile
Find all posts by Don Guillett