Robin
By "remove" do you mean hide or delete the row? If a row is deleted
it's gone forever once the file is saved. If the row is hidden, it can be
simply un-hidden later and it's back. Start a new post or contact me
direct. My Outlook Express is listing your posts back with the thread in
October and I'm losing you. My email address is
(E-Mail Removed).
Remove the "nop" from this address. HTH Otto
"Cheekyaardvark" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Otto...
> Not sure if I posted this correctly last time.. but I was wanting to
> take the macro here one step further & have it so that if I highlight
> any column in any spreadsheet that it would remove any rows with zero
> value in that column... I had macros before that simply utilised
> autofilter but with Excel 2003 when using large files excel just seems
> to hang
>
> Can you give me some guidance..
> Much Appreciated
>
> Robin
>
>
> Otto Moehrbach wrote:
>
>> Ann
>> When you are looping through a range and deleting rows, you want to
>> be
>> sure you loop from the bottom up rather than from the top down. This
>> macro
>> will do what you want, but your "blank" cells in Column AB must be
>> actually
>> blank. I know you say Huh? at this point but when data is brought into
>> Excel from an external source, problems may come with the data. For
>> instance, a "blank" cell may have a space in it. That cell is not blank.
>> It is an occupied cell. I included code in this macro to Trim (remove
>> all
>> extraneous spaces) all the cells in Column AB. Come back if this macro
>> does
>> not delete ALL the "blank" cells. HTH Otto
>> Sub RemoveBlank()
>> Dim RngColAB As Range
>> Dim c As Long
>> Application.ScreenUpdating = False
>> Set RngColAB = Range("AB2", Range("AB" & Rows.Count).End(xlUp))
>> For c = RngColAB.Count To 1 Step -1
>> RngColAB(c).Value = Application.Trim(RngColAB(c))
>> If IsEmpty(RngColAB(c).Value) Then _
>> RngColAB(c).EntireRow.Delete
>> Next c
>> Application.ScreenUpdating = True
>> End Sub
>> "Ann Scharpf" <(E-Mail Removed)> wrote in message
>> news:2C84CE8B-9688-4235-9F7A-(E-Mail Removed)...
>> >I am working in an Excel sheet where data is dumped from another system.
>> > Many of the rows are extraneous - if the cell in the Current Hours
>> > column
>> > (AB) contains a zero value, I'd like my macro to delete the row.
>> > Someone
>> > here at my office knows more VBA than I do (which is very little) and
>> > we
>> > came
>> > up with the following. It is NOT working correctly.
>> >
>> > The current sheet of test data contains 575 rows. Of these, 24 have
>> > values
>> > greater than zero in column AB. 551 rows contain a zero in AB. When I
>> > run
>> > the macro, it does not seem to actually be using the values in AB to
>> > determine what to delete. Depending on which cell is active when I
>> > start,
>> > sometimes there are values > 0 in AB, other times they are all = 0. I
>> > end
>> > up
>> > with a different number of rows depending on where I start.
>> >
>> > Here is the code of the macro. If anyone can tell me how to make the
>> > macro
>> > look at the contents of the cells in column AB and delete when they
>> > contain
>> > 0, I would really appreciate it.
>> >
>> > Thanks very much for your help.
>> >
>> > Sub DelBlankCurHrsRows()
>> > '
>> > ' DelBlankCurHrsRows Macro
>> > ' Macro recorded 10/18/2006 by Ann Scharpf
>> > '
>> > ' Keyboard Shortcut: Ctrl+Shift+E
>> > '
>> > For Each c In Worksheets("Paste all employees' data
>> > here").Range("AB2:AB41000")
>> > If c.Value = "0" Then
>> > Selection.EntireRow.Delete
>> > End If
>> > Next
>> > End Sub
>> >
>> >
>> >
>> >
>> > --
>> > Ann Scharpf
>