Insert Row when zero or Positive value

  • Thread starter Thread starter FIRSTROUNDKO via OfficeKB.com
  • Start date Start date
F

FIRSTROUNDKO via OfficeKB.com

Hi,

I have sorted a collumn in ascending value from negative to positive, I want
to insert a row when the change in the value is zero or greater. i.e

-2
-1
0
1

Becomes

-2
-1

0
1

The Collumn changes in length and sometimes there maybe no negative numbers
and sometimes there may be no positve numbers

Can sombody Please help me Thanks in advance

Darren
 
assume column 3 (C)

Sub AddRow()
Dim col as Long, i as long
Dim lastrow as Long
col = 3
lastrow=cells(rows.count,col).End(xlup).row
for i = lastrow to 2 step -1
if cells(i-1,col) < 0 then
rows(i).Insert
exit sub
end if
Next
End Sub
 
Back
Top