View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Thomas [PBD] Thomas [PBD] is offline
external usenet poster
 
Posts: 154
Default Delete rows with macro not working

Greg,

Have you used the =ISBLANK(<cell) function to determine if the cells are in
fact empty? If so, and it returns "FALSE" then you have some underlying code.

You would have to figure out what exactly are in the cells, are they spaces,
are they Hardcode returns (which appear as null spots but are infact coding
into the cells), or a special character of some type. There are a lot of
errors sometimes when users attempt to import excel information from the
Internet primarily the Hardcode returns.
I believe without the actual items in the cells, you might have a hard time
accomplishing this task. Maybe you can watch the user enter the information
one day and figure out where he is going astray.

--
--Thomas [PBD]
Working hard to make working easy.


"Greg Snidow" wrote:

Greetings all. I have a macro that, among other things, deletes all rows
from a sheet where ever a cell in one column is blank. The part of the macro
in question is below.

' Delete rows with no job number
Dim rng As Range
On Error Resume Next
Set rng = Columns(4).SpecialCells(xlBlanks)
On Error GoTo 0
If Not rng Is Nothing Then
rng.EntireRow.Delete
End If

The problem is that recently it does not work for some rows on a report from
a particular user. The cells in column 4 appear to be blank, but when I run
the macro, they are not deleted. If I first highlight all the cells that
appear to be blank, and hit delete, then run the macro, it works fine, so
there seems to be some zero length strings, or just blank spaces in some of
the cells. My question is, how can I include these cells in the set to be
deleted? Thank you.

Greg Snidow