Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to enter blank row
Similar to "SubTotal" without the subtotal, i'm looking to create a macro
that will search for a change in column info and insert a blank row between. Can you help? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to enter blank row
Hi Missy,
Try: '============ Public Sub Tester001() Dim rng As Range Dim rcell As Range Dim i As Long Const col As String = "A" '<<==== CHANGE For i = Selection.Rows.Count To 2 Step -1 With Cells(i, col) If .Value < .Offset(-1).Value Then .EntireRow.Insert End If End With Next i End Sub '<<============ Change the value of the col constant to reflect your column of interest. --- Regards, Norman "MissyLovesExcel" wrote in message ... Similar to "SubTotal" without the subtotal, i'm looking to create a macro that will search for a change in column info and insert a blank row between. Can you help? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to enter blank row
Hi Missy,
Deleting two redundant variables and taking the opportunity to toggle Screen updates, try: '============ Public Sub Tester001() Dim i As Long Const col As String = "A" '<<==== CHANGE Application.ScreenUpdating = False For i = Selection.Rows.Count To 2 Step -1 With Cells(i, col) If .Value < .Offset(-1).Value Then .EntireRow.Insert End If End With Next i Application.ScreenUpdating = True End Sub '<<============ --- Regards, Norman "Norman Jones" wrote in message ... Hi Missy, Try: '============ Public Sub Tester001() Dim rng As Range Dim rcell As Range Dim i As Long Const col As String = "A" '<<==== CHANGE For i = Selection.Rows.Count To 2 Step -1 With Cells(i, col) If .Value < .Offset(-1).Value Then .EntireRow.Insert End If End With Next i End Sub '<<============ Change the value of the col constant to reflect your column of interest. --- Regards, Norman "MissyLovesExcel" wrote in message ... Similar to "SubTotal" without the subtotal, i'm looking to create a macro that will search for a change in column info and insert a blank row between. Can you help? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to select cells in column enter data then press enter | New Users to Excel | |||
If cell a1 not blank enter 8.26 in A2 ???? How | Excel Worksheet Functions | |||
HOW TO ENTER A BLANK IN WORKSHEET FUNCTION | Excel Worksheet Functions | |||
Run formula only if values are enter, otherwise leave blank | Excel Worksheet Functions | |||
enter numbers in blank cells | Excel Worksheet Functions |