View Single Post
  #9   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"

If I paste your numbers into cell C1 (so they fill columns C to F), then it
runs fine. You said your changing numbers were in Column E.

I have an excel sheet with 5419 rows and the column E has numbers that

increases after certain rows.

If your numbers are in columns A to D, then this modification works

Sub Tester1()
Dim rng As Range, i As Long
Set rng = Cells(Rows.Count, 3).End(xlUp)
For i = rng.Row To 1 Step -1
If Cells(i + 1, 3) < Cells(i, 3) Then
Cells(i + 1, 3).EntireRow.Insert
End If
Next

End Sub

If you give incorrect information, don't expect the solution offered to
work.

--
Regards,
Tom Ogilvy

"vernerv " wrote in message
...
Hey Tom,

Many thanks for the response, but the macro just would'nt run.

This is what I have:

166930.000000 5272038.000000 1 1.500000
165949.000000 5272484.000000 1 1.500000
165325.000000 5273019.000000 1 1.500000
164879.000000 5273733.000000 1 1.500000
164826.000000 5273945.000000 1 1.500000
163541.000000 5273019.000000 2 1.500000
163720.000000 5274804.000000 2 1.500000
163987.000000 5276409.000000 2 1.500000

This is what I would need:

166930.000000 5272038.000000 1 1.500000
165949.000000 5272484.000000 1 1.500000
165325.000000 5273019.000000 1 1.500000
164879.000000 5273733.000000 1 1.500000
164826.000000 5273945.000000 1 1.500000

163541.000000 5273019.000000 2 1.500000
163720.000000 5274804.000000 2 1.500000
163987.000000 5276409.000000 2 1.500000


The number after 1,2.....till 379. I would need to have a line breaks
after all the 1's, the 2's and like that till the last one, ie. 379

Any suggestion?

Cheers
Elvis


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