Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing Marco
I currently have two marcos that I would like to slightly change. They were
originally what I wanted, until I realized that by inserting and deleting rows they were messing up other data on my sheet. Here are the two I have: Sub InsertFiveRows() Dim LastRow As Long LastRow = Cells(Rows.Count, "A").End(xlUp).Row v = Rows(LastRow - 1).Formula Cells(LastRow - 1, "A").Resize(5, 1).EntireRow.Insert Rows(LastRow - 1) = v Rows(LastRow + 4).ClearContents Range("AU2:BG6").Copy Cells(LastRow, "A") End Sub Sub DeleteFiveRows() Dim lr As Long, x As Long lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row x = lr - 5 ActiveSheet.Rows(x & ":" & lr -1).Delete End Sub Can you help me so that I can shift the cells up or down rather than inserting and deleting cells. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing Marco | Excel Programming | |||
Marco | Excel Discussion (Misc queries) | |||
Changing Cell Backround from Marco | Excel Programming | |||
Marco | New Users to Excel | |||
Marco to run every day at 12 | Excel Programming |