View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
STEVE BELL STEVE BELL is offline
external usenet poster
 
Posts: 692
Default vba code doesn't work

If you are using this code

Sub deletezero()
For i = ActiveCell.End(xlDown).Row To 1 Step -1
If Cells(i, 1) = 0 Then Rows(i).Delete
Next
End Sub


You might enter an additional elseif (providing you are looking for
numerical entries)
(of course you can combine them into a single if: If condition1 or
condition 2 then...)
Elseif worksheetfunction.sum(Rows(1))= 0 then

or
Elseif worksheetfunction.Count(Rows(1)) = 0 then


--
steveB

Remove "AYN" from email to respond
"lschuh" wrote in message
...
In going through my worksheet I have used a transferspreadsheet from
MSAccess. The data within the query that transfers has several 0 in it so
I
don't want to remove those. However, there are several rows of blank data
at
the end of the spreadsheet that are null records. Can I do some kind of
modification of this code to look for rows with empty records?

"K Dales" wrote:

Do Until ActiveCell.Value = ""
Should have no space between the quotes
--
- K Dales


"lschuh" wrote:

I found an example of vba code in a book "Using Excel 2003". It
doesn't work
and locks the entire application up. The code is:
Sub removenull()
Application.ScreenUpdating = False
Do Until ActiveCell.Value = " "
If ActiveCell.Value = 0 Then
ActiveCell.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
End Sub


It is supposed to remove 0 from rows and delete rows.

What is wrong with it?