Thread: removing data
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default removing data

Here we start at the bottom of a column and work upward. We check that the
data is increasing (moving downwards). When we find the breakpoint, we
delete all cells above the point.

Sub lucile()
n = Cells(Rows.Count, "A").End(xlUp).Row
v = Cells(n, "A").Value
For i = n - 1 To 1 Step -1
If v < Cells(i, "A").Value Then
Exit For
Else
v = Cells(i, "A").Value
End If
Next
Range("A1:A" & i).Delete Shift:=xlUp
End Sub

--
Gary''s Student - gsnu200823


"Lucile" wrote:

Hi all,
I need your help!

I have a column of data that goes up, down, up, down... and finally
increases to a maximum. I need to remove the up and down portion to keep only
the final increase...

Any ideas how to do that?
Thanks