Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 Tom, Thanks for the macro 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? 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/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to Insert Current Date into cell - Macro to "Save As" | Excel Worksheet Functions | |||
How to insert a "Target" line into basic bar chart | Charts and Charting in Excel | |||
Lost "File Menu" - now it's "Edit / View / Insert.." but no "F | Excel Discussion (Misc queries) | |||
Is there a formula thet reads (If A2=A1,"",INSERT PAGE BREAK) ? | Excel Discussion (Misc queries) | |||
Insert "-" in text "1234567890" to have a output like this"123-456-7890" | Excel Discussion (Misc queries) |