Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Koz Koz is offline
external usenet poster
 
Posts: 8
Default How do I automatically delete a row, if one cell equals zero?


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,117
Default How do I automatically delete a row, if one cell equals zero?

Option Explicit

Sub Koz()

Dim myLastRow As Long
Dim r As Long
Dim c As Range

myLastRow = ActiveSheet.Cells(10000, 1).End(xlUp).Row

For r = myLastRow To 1 Step -1
Set c = ActiveSheet.Range("a" & r)
If c.Value = 0 Then
c.EntireRow.Delete
End If
Next r

End Sub
==================
this is a macro - you can't do what you want with formulas without
having a helper column and either auto filtering or manually deleting
rows yourself. in this macro, if column A is zero, the entire row
will be deleted.
next time don't put the whole question in the header..... it's
considered bad manners. if this macro doesn't do what you want, post
back with details & i can amend it.
hope this helps
:)
susan



On Jul 29, 2:15*pm, Koz wrote:


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Koz Koz is offline
external usenet poster
 
Posts: 8
Default How do I automatically delete a row, if one cell equals zero?

Sorry about the header!
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 143
Default Bad Manners :(

Susan,
Sorry for the bad manners, but I'm new to this group and was unaware I was
being rude. Thanks so much for your very quick reply. However, my situation
is this. I have a 800 page spreadsheet, I need to delete certain rows. I
need to delete rows where in Columns J through M equals zero. Also, can you
please tell me where to write this formula/macro. I am unfamiliar with this
aspect of Excel. Again, I am forever grateful for you help.

"Susan" wrote:

Option Explicit

Sub Koz()

Dim myLastRow As Long
Dim r As Long
Dim c As Range

myLastRow = ActiveSheet.Cells(10000, 1).End(xlUp).Row

For r = myLastRow To 1 Step -1
Set c = ActiveSheet.Range("a" & r)
If c.Value = 0 Then
c.EntireRow.Delete
End If
Next r

End Sub
==================
this is a macro - you can't do what you want with formulas without
having a helper column and either auto filtering or manually deleting
rows yourself. in this macro, if column A is zero, the entire row
will be deleted.
next time don't put the whole question in the header..... it's
considered bad manners. if this macro doesn't do what you want, post
back with details & i can amend it.
hope this helps
:)
susan



On Jul 29, 2:15 pm, Koz wrote:



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 964
Default Bad Manners :(

http://www.mvps.org/dmcritchie/excel/install.htm

--


Regards,


Peo Sjoblom

"Marie" wrote in message
...
Susan,
Sorry for the bad manners, but I'm new to this group and was unaware I was
being rude. Thanks so much for your very quick reply. However, my
situation
is this. I have a 800 page spreadsheet, I need to delete certain rows. I
need to delete rows where in Columns J through M equals zero. Also, can
you
please tell me where to write this formula/macro. I am unfamiliar with
this
aspect of Excel. Again, I am forever grateful for you help.

"Susan" wrote:

Option Explicit

Sub Koz()

Dim myLastRow As Long
Dim r As Long
Dim c As Range

myLastRow = ActiveSheet.Cells(10000, 1).End(xlUp).Row

For r = myLastRow To 1 Step -1
Set c = ActiveSheet.Range("a" & r)
If c.Value = 0 Then
c.EntireRow.Delete
End If
Next r

End Sub
==================
this is a macro - you can't do what you want with formulas without
having a helper column and either auto filtering or manually deleting
rows yourself. in this macro, if column A is zero, the entire row
will be deleted.
next time don't put the whole question in the header..... it's
considered bad manners. if this macro doesn't do what you want, post
back with details & i can amend it.
hope this helps
:)
susan



On Jul 29, 2:15 pm, Koz wrote:







  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,117
Default sum in condition for macro

marie - no problem about the headers! :)

as to the macro, peo's answered you about where to put it.
as to amending it so that the condition is that columns J thru M equal
zero....... well, you've got me a bit stumped there. not quite sure
how to do that, but i'll go away & play with it a bit & maybe i can
figure it out.
i've changed the header & maybe somebody else can help you out with
that part in case i fail!
best wishes
susan



On Aug 13, 12:33*pm, Marie wrote:
Susan,
Sorry for the bad manners, but I'm new to this group and was unaware I was
being rude. *Thanks so much for your very quick reply. However, my situation
is this. *I have a 800 page spreadsheet, I need to delete certain rows. *I
need to delete rows where in Columns J through M equals zero. *Also, can you
please tell me where to write this formula/macro. *I am unfamiliar with this
aspect of Excel. *Again, I am forever grateful for you help.



"Susan" wrote:
Option Explicit


Sub Koz()


Dim myLastRow As Long
Dim r As Long
Dim c As Range


myLastRow = ActiveSheet.Cells(10000, 1).End(xlUp).Row


For r = myLastRow To 1 Step -1
* *Set c = ActiveSheet.Range("a" & r)
* * * If c.Value = 0 Then
* * * c.EntireRow.Delete
* * * End If
Next r


End Sub
==================
this is a macro - you can't do what you want with formulas without
having a helper column and either auto filtering or manually deleting
rows yourself. *in this macro, if column A is zero, the entire row
will be deleted.
next time don't put the whole question in the header..... it's
considered bad manners. *if this macro doesn't do what you want, post
back with details & i can amend it.
hope this helps
:)
susan


On Jul 29, 2:15 pm, Koz wrote:- Hide quoted text -


- Show quoted text -


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,117
Default sum in condition for macro

well, i cheated, but it works. i'm sure there's another way to do it,
but like i said, i don't know how.
this simply looks at the four columns & if they all have zeros in them
(the only way it would add up to zero), then it deletes the row. i'd
sure be interested in seeing how to do it by adding the four columns
up, if anybody else knows how to do that.
=======================
Option Explicit

Sub Marie()

Dim myLastRow As Long
Dim r As Long
Dim c As Range

myLastRow = ActiveSheet.Cells(10000, 10).End(xlUp).Row

For r = myLastRow To 1 Step -1
Set c = ActiveSheet.Range("j" & r)
If c.Value = 0 And _
c.Offset(0, 1).Value = 0 And _
c.Offset(0, 2).Value = 0 And _
c.Offset(0, 3).Value = 0 Then
c.EntireRow.Delete
End If
Next r

End Sub
=========================
of course, this doesn't account for blanks, so......... don't know if
that will be a problem.
hope it helps somewhat, tho!
:)
susan



On Aug 13, 3:34*pm, Susan wrote:
marie - no problem about the headers! *:)

as to the macro, peo's answered you about where to put it.
as to amending it so that the condition is that columns J thru M equal
zero....... well, you've got me a bit stumped there. *not quite sure
how to do that, but i'll go away & play with it a bit & maybe i can
figure it out.
i've changed the header & maybe somebody else can help you out with
that part in case i fail!
best wishes
susan

On Aug 13, 12:33*pm, Marie wrote:



Susan,
Sorry for the bad manners, but I'm new to this group and was unaware I was
being rude. *Thanks so much for your very quick reply. However, my situation
is this. *I have a 800 page spreadsheet, I need to delete certain rows. *I
need to delete rows where in Columns J through M equals zero. *Also, can you
please tell me where to write this formula/macro. *I am unfamiliar with this
aspect of Excel. *Again, I am forever grateful for you help.


"Susan" wrote:
Option Explicit


Sub Koz()


Dim myLastRow As Long
Dim r As Long
Dim c As Range


myLastRow = ActiveSheet.Cells(10000, 1).End(xlUp).Row


For r = myLastRow To 1 Step -1
* *Set c = ActiveSheet.Range("a" & r)
* * * If c.Value = 0 Then
* * * c.EntireRow.Delete
* * * End If
Next r


End Sub
==================
this is a macro - you can't do what you want with formulas without
having a helper column and either auto filtering or manually deleting
rows yourself. *in this macro, if column A is zero, the entire row
will be deleted.
next time don't put the whole question in the header..... it's
considered bad manners. *if this macro doesn't do what you want, post
back with details & i can amend it.
hope this helps
:)
susan


On Jul 29, 2:15 pm, Koz wrote:- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If a cell equals _, at the next row that equals _, return value fr CathyH Excel Worksheet Functions 10 May 2nd 07 07:53 PM
If cell is left blank, or equals zero, then cell equals a different cell John McMurry Excel Discussion (Misc queries) 3 April 13th 07 01:14 PM
Delete cell on 1 page: automatically delete on another page? mountain view Excel Worksheet Functions 0 September 28th 06 04:18 PM
Delete values from cell automatically ernie Excel Discussion (Misc queries) 5 February 15th 06 09:01 PM
How do I delete the automatically inserted ' in every Excel cell? SLW Excel Discussion (Misc queries) 6 August 24th 05 03:17 PM


All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"