![]() |
Macros to Cut and Paste
I have the following macro and I need one additional step after it finished the macro. The initial macro added 10 rows until the last person is there, but there are values in b1, b10,b20, etc and I need those values to cut and pasted in a10, a15 and so on until the last value has been posted. If somebody can help I would really appreciate it.
Sub insert_rows( Dim lastrow As Lon Dim row_index As Lon lastrow = ActiveSheet.Cells(rows.Count, "A").End(xlUp).ro For row_index = lastrow - 1 To 1 Step - If Cells(row_index, "A").Value < Cells(row_index + 1, "A").Value The Cells(row_index + 1, "A").Resize(10, 1).EntireRow.insert (xlShiftDown Range(Selection, Selection.End(xlDown)).Selec Range(Selection, Selection.End(xlToRight)).Selec End I Nex End Su |
Macros to Cut and Paste
It is unclear how on column row 1 + 9 rows + 10 rows
relates to row 10, row 15, -- --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "David" wrote in message ... I have the following macro and I need one additional step after it finished the macro. The initial macro added 10 rows until the last person is there, but there are values in b1, b10,b20, etc and I need those values to cut and pasted in a10, a15 and so on until the last value has been posted. If somebody can help I would really appreciate it. Sub insert_rows() Dim lastrow As Long Dim row_index As Long lastrow = ActiveSheet.Cells(rows.Count, "A").End(xlUp).row For row_index = lastrow - 1 To 1 Step -1 If Cells(row_index, "A").Value < Cells(row_index + 1, "A").Value Then Cells(row_index + 1, "A").Resize(10, 1).EntireRow.insert (xlShiftDown) Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select End If Next End Sub |
All times are GMT +1. The time now is 01:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com