Üzerinde çalıştığım program, i - (i + 1) ve i- (i-1) form excel arasındaki farkın okunması ve belirlenmesini içerir. Fark 4 değerini aşarsa, program satırı s de siler. Program ilk denemede iyi çalışıyor. Ancak, tekrarladığımda, silinmemesi gereken noktaları silmeye başlar.Koşullar yerine getirildiğinde excel'in tüm satırı nasıl kaldırılır
Seçenek Belirtik
Sub Data_Delet()
Dim a As Double, b As Double, c As Double, i As Double
Dim rkill As Range
' a,b, and c are used as steps in order to proceed to the next data points
a = 18
b = 0
c = 0
With ThisWorkbook.Worksheets("Sheet1")
' The second do loop delete data points that does not follow the requirements
Do
If Abs(.Cells(a - 1, 2) - .Cells(a, 2)) > 4 And Abs(.Cells(a, 2) - .Cells(a + 1, 2)) > 4 Then
If rkill Is Nothing Then
Set rkill = Rows(a)
Else
Set rkill = Union(rkill, Rows(a))
End If
End If
a = a + 1
Loop Until .Cells(a, 2).Value = ""
rkill.EntireRow.Delete
End With
End Sub