I have a macro written that sifts through the active column and ignores data that is greater than 18 and less than or equal to 0. In addition to this I would like to sift through the column to the left of the active cell and skip over data where the absolute value of the difference between the next row and the current row is greater than 0.2. Basically I don't want any change greater than 0.2. I have very limited experience and could use help figuring this out. I have posted the working macro below:
Sub mypicker()
rownow=activecell.row
columnnow=activecolumn.column
newrow=9
newcolumn=1
mytime=0
While Cells(rownow,columnnow).Value <> ""
If Cells (rownow,columnnow).Value >18 or (rownow,columnnow).Value <=0 Then
mya=myb
Else
Cells(newrow,newcolumn).Value = mytime
Cells(newrow,newcolumn+1).Value = Cells(rownow,columnnow-1).Value
Cells(newrow,newcolumn+4).Value = Cells(rownow,column now).Value
newrow=newrow+1
End If
rownow=rownow+1
mytime=mytime+1
Wend
End Sub
I tried to put the following code before then on the first if statement but had no luck. Your help is greatly appreciated:
Or Abs(Cells(rownow-1,columnnow+1)-Cells(rownow-1,columnnow)>0.2)
Sub mypicker()
rownow=activecell.row
columnnow=activecolumn.column
newrow=9
newcolumn=1
mytime=0
While Cells(rownow,columnnow).Value <> ""
If Cells (rownow,columnnow).Value >18 or (rownow,columnnow).Value <=0 Then
mya=myb
Else
Cells(newrow,newcolumn).Value = mytime
Cells(newrow,newcolumn+1).Value = Cells(rownow,columnnow-1).Value
Cells(newrow,newcolumn+4).Value = Cells(rownow,column now).Value
newrow=newrow+1
End If
rownow=rownow+1
mytime=mytime+1
Wend
End Sub
I tried to put the following code before then on the first if statement but had no luck. Your help is greatly appreciated:
Or Abs(Cells(rownow-1,columnnow+1)-Cells(rownow-1,columnnow)>0.2)