![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 1,290
|
I have a sheet with 6 columns(A:F)
In each row (+/- 2000 rows) is a number. Now what I want to do is to delete the entire row is the difference between A:B or between B:C or between C:D or between D:E or between E:F is more then 15. Who can help me? Thanks in advance |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
This should do it ... Please let me know if it works
Code:
Public Sub DeleteRow()
For rw = 1 To Cells(65536, 1).End(xlUp).Row
If (Abs((Abs(Cells(rw, 1).Value)) - (Abs(Cells(rw, 2).Value))) > 15) Or _
(Abs((Abs(Cells(rw, 2).Value)) - (Abs(Cells(rw, 3).Value))) > 15) Or _
(Abs((Abs(Cells(rw, 3).Value)) - (Abs(Cells(rw, 4).Value))) > 15) Or _
(Abs((Abs(Cells(rw, 4).Value)) - (Abs(Cells(rw, 5).Value))) > 15) Or _
(Abs((Abs(Cells(rw, 5).Value)) - (Abs(Cells(rw, 6).Value))) > 15) Then
Cells(rw, rw).EntireRow.Delete
rw = rw - 1
End If
Next
End Sub
[ This Message was edited by: Nimrod on 2002-05-18 16:47 ] |
|
|
|
|
|
#3 | |
|
Board Regular
Join Date: Mar 2002
Posts: 1,290
|
Quote:
|
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Guderup, Denmark
Posts: 287
|
Cells(rw, 1).EntireRow.Delete
regards Tommy |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
Thanks Tommy
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|