View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default "Insert Line Break-Macro"

assume by line break you mean insert a blank row.

Dim rng as Range, i as Long
set rng = cells(rows.count,5).End(xlup)
for i = rng.row to 1 step - 1
if cells(i+1,5) < cells(i,5) then
cells(i+1,5).EntireRow.Insert
end if
Next

--
Regards,
Tom Ogilvy


"vernerv " wrote in message
...
Hello,

OS:WINXP/Office2000

I have an excel sheet with 5419 rows and the column E has numbers that
increases after certain rows. Eg: All rows from row 1 to row 9, is "1"
then all rows from row 10 to row 34 has "2" and so on.. till "379"

Now:
1
1
1
1
1
1
1
2
2
2
2
2
2
3
3
3

I need a macro to make it look like:
1
1
1
1
1
1
1

2
2
2
2
2
2
2

3
3
3
3
3
3

I need to write a macro to insert a line break after the row that ends
with 1 and similarily a line break after the row that ends with 2 and
so on.. till the nth(379) numbered row

Can anyone please help? Thanks
Verner


---
Message posted from http://www.ExcelForum.com/