Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Delete all Rows in a Variable Range

How can I delete all Rows in a variable range where the value in Column J
returns Zero and move all Rows below up. Column J contains a formula
relating to other values in the same row.

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Delete all Rows in a Variable Range

here is two posibilitys

Sub killme()
Dim r As Range
For Each r In Selection
If r.Column = 10 And r.Value = 0 Then
r.EntireRow.Delete
Next
End Sub

or

Sub killme()
Dim r As Range
For Each r In Selection
If Cells(r.Row, 10) = 0 Then r.EntireRow.Delete
Next
End Sub

-----Original Message-----
How can I delete all Rows in a variable range where the

value in Column J
returns Zero and move all Rows below up. Column J

contains a formula
relating to other values in the same row.

Thanks


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Delete all Rows in a Variable Range

Thanks Steve, one small error appearing, I've added to it just a small bit
but I'm stuck after "Next" - with error Next without For

Sub DeleteZerosinIngredients()

With Application
.ScreenUpdating = False
.Calculation = xlManual
.MaxChange = 0.001
End With

Dim r As Range
For Each r In Selection

Sheets("Ingredient Mix").Select
With ActiveSheet
If Cells(r.Row, 10) = 0 Then r.EntireRow.Delete
Next

End With
With Application
.ScreenUpdating = True
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False

End Sub




"steve" wrote in message
...
here is two posibilitys

Sub killme()
Dim r As Range
For Each r In Selection
If r.Column = 10 And r.Value = 0 Then
r.EntireRow.Delete
Next
End Sub

or

Sub killme()
Dim r As Range
For Each r In Selection
If Cells(r.Row, 10) = 0 Then r.EntireRow.Delete
Next
End Sub

-----Original Message-----
How can I delete all Rows in a variable range where the

value in Column J
returns Zero and move all Rows below up. Column J

contains a formula
relating to other values in the same row.

Thanks


.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Delete all Rows in a Variable Range

John,
Sheets("Ingredient Mix").Select
'I think you have to make a range selection
'Sheets("Ingredient Mix").Range("A1:A1000").Select

For Each r In Selection
With ActiveSheet
If Cells(r.Row, 10) = 0 Then r.EntireRow.Delete
End With
Next

"John" wrote in message
...
Thanks Steve, one small error appearing, I've added to it just a small bit
but I'm stuck after "Next" - with error Next without For

Sub DeleteZerosinIngredients()

With Application
.ScreenUpdating = False
.Calculation = xlManual
.MaxChange = 0.001
End With

Dim r As Range
For Each r In Selection

Sheets("Ingredient Mix").Select
With ActiveSheet
If Cells(r.Row, 10) = 0 Then r.EntireRow.Delete
Next

End With
With Application
.ScreenUpdating = True
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False

End Sub




"steve" wrote in message
...
here is two posibilitys

Sub killme()
Dim r As Range
For Each r In Selection
If r.Column = 10 And r.Value = 0 Then
r.EntireRow.Delete
Next
End Sub

or

Sub killme()
Dim r As Range
For Each r In Selection
If Cells(r.Row, 10) = 0 Then r.EntireRow.Delete
Next
End Sub

-----Original Message-----
How can I delete all Rows in a variable range where the

value in Column J
returns Zero and move all Rows below up. Column J

contains a formula
relating to other values in the same row.

Thanks


.





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
Select a range of rows to delete Donna[_3_] Excel Worksheet Functions 2 January 26th 10 07:32 PM
Deleting a range of rows based on a variable; syntax error Babymech Excel Discussion (Misc queries) 3 January 16th 09 06:19 PM
Variable criteria to delete rows Jeff Bertram Excel Programming 18 July 21st 08 07:30 PM
delete rows in range - macro hindu cliparts Excel Worksheet Functions 0 November 16th 06 09:54 PM
How to copy&paste a variable range rows and colums IK Excel Discussion (Misc queries) 1 August 30th 06 12:06 AM


All times are GMT +1. The time now is 12:11 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"