ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Row when zero or Positive value (https://www.excelbanter.com/excel-programming/356385-insert-row-when-zero-positive-value.html)

FIRSTROUNDKO via OfficeKB.com

Insert Row when zero or Positive value
 
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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1

Tom Ogilvy

Insert Row when zero or Positive value
 
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

--
Regards,
Tom Ogilvy


"FIRSTROUNDKO via OfficeKB.com" <u15639@uwe wrote in message
news:5d69e9a1d65c3@uwe...
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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1




sunny

Insert Row when zero or Positive value
 
sorry if u get u reply me back..

FIRSTROUNDKO via OfficeKB.com wrote:

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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1




All times are GMT +1. The time now is 06:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com