Code for macro that conditionally inserts rows
Solved/Closed
bfleming
Posts
3
Registration date
Thursday February 14, 2013
Status
Member
Last seen
February 15, 2013
-
Feb 14, 2013 at 07:14 AM
bfleming Posts 3 Registration date Thursday February 14, 2013 Status Member Last seen February 15, 2013 - Feb 15, 2013 at 07:01 AM
bfleming Posts 3 Registration date Thursday February 14, 2013 Status Member Last seen February 15, 2013 - Feb 15, 2013 at 07:01 AM
Related:
- Macro to insert row in excel based on criteria
- How to insert rows in excel automatically based on cell value without vba ✓ - Excel Forum
- Insert key on keyboard - Guide
- Excel online macros - Guide
- Based on the cell values in cells b77 ✓ - Excel Forum
- Saints row 2 cheats - Guide
2 responses
bfleming
Posts
3
Registration date
Thursday February 14, 2013
Status
Member
Last seen
February 15, 2013
2
Feb 14, 2013 at 08:50 AM
Feb 14, 2013 at 08:50 AM
It would be a blank row. Thanks!
Feb 14, 2013 at 10:57 AM
Sub InsertRows() Dim r As Long Dim mcol As Date Dim I As Long ' find last used cell in Column A r = Cells(Rows.Count, "A").End(xlUp).Row ' get value of last used cell in column A mcol = Cells(r, 1).Value ' insert rows by looping from bottom For I = r To 2 Step -1 'if current value is not same as the current row being tested If Cells(i, 1) <> mcol Then 'both values are not same, so insert row Rows(i + 1).Insert End If 'change date by one day back mcol = DateAdd("d", -1, mcol) Next i End SubFeb 15, 2013 at 07:01 AM