![]() |
"Insert LineBreak-Macro"Thanks BOB!
Hey Bob!
Thanks a ton! The macro worked! I know I'm pushing my luck, but is there anyway I can enter value(-111) inside the blank cells of the first 4 columns once the have been created using this macro? Your Macro: Sub InsertBlanks() Dim i As Long For i = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1 If Cells(i, "A").Value < Cells(i - 1, "A").Value Then Cells(i, "A").EntireRow.Insert i = i - 1 ' skip new line End If Next i End Sub I have changed the column"A" to "C" as I need that to check for th incremental number within that column and introduce the blank row. No in the 4 columns I would require the value -111 to be introduced usin the same macro. This is my actual requirment: 25.345085 51.367877 1 0 25.784345 50.356682 1 0 -111 -111 -111 -111 66.179288 47.117222 2 0 66.164537 47.128142 2 0 -111 -111 -111 -111 Any suggestions? Thanks a lot! Verne -- Message posted from http://www.ExcelForum.com |
"Insert LineBreak-Macro"Thanks BOB!
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 Cells(i + 1, 1).Resize(1, 4).Value = -111 End If Next End Sub Worked fine for me. -- Regards, Tom Ogilvy "vernerv " wrote in message ... Hey Bob! Thanks a ton! The macro worked! I know I'm pushing my luck, but is there anyway I can enter a value(-111) inside the blank cells of the first 4 columns once they have been created using this macro? Your Macro: Sub InsertBlanks() Dim i As Long For i = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1 If Cells(i, "A").Value < Cells(i - 1, "A").Value Then Cells(i, "A").EntireRow.Insert i = i - 1 ' skip new line End If Next i End Sub I have changed the column"A" to "C" as I need that to check for the incremental number within that column and introduce the blank row. Now in the 4 columns I would require the value -111 to be introduced using the same macro. This is my actual requirment: 25.345085 51.367877 1 0 25.784345 50.356682 1 0 -111 -111 -111 -111 66.179288 47.117222 2 0 66.164537 47.128142 2 0 -111 -111 -111 -111 Any suggestions? Thanks a lot! Verner --- Message posted from http://www.ExcelForum.com/ |
"Insert LineBreak-Macro"Thanks BOB!
Hey Tom,
Thanks a lot! You guys are doing a good one with the forum! Been of great help at the right time! Cheers! Verne -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 06:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com