Hi everyone.
I have a table with 2 columns A and B. Both columns contain a long list of numbers. I would like to run a makro that has two steps.
1) Insert a new row inbetween each row (my makro below does that already)
2) After inserting a new row it shall copy the value from the row above.
In other words. I have columns A and B and five rows as shown below.
A B
6 3
4 5
3 1
2 3
The makro shall then insert a new row between each line and copy the value from the cells above, so that the result will be:
A B
6 3
6 3
4 5
4 5
3 1
3 1
2 3
2 3
My makro is missing the 2nd step (copying the values from above). It currently looks like this:
Sub Insert_Blank_Rows()
'Select last row in worksheet.
Selection.End(xlDown).Select
Do Until ActiveCell.Row = 1
'Insert blank row.
ActiveCell.EntireRow.Insert shift:=xlDown
'Move up one row.
ActiveCell.Offset(-1, 0).Select
Loop
End Sub
Does anyone know how I include the 'copying from above' part?
Thank you so much,
Alex
I have a table with 2 columns A and B. Both columns contain a long list of numbers. I would like to run a makro that has two steps.
1) Insert a new row inbetween each row (my makro below does that already)
2) After inserting a new row it shall copy the value from the row above.
In other words. I have columns A and B and five rows as shown below.
A B
6 3
4 5
3 1
2 3
The makro shall then insert a new row between each line and copy the value from the cells above, so that the result will be:
A B
6 3
6 3
4 5
4 5
3 1
3 1
2 3
2 3
My makro is missing the 2nd step (copying the values from above). It currently looks like this:
Sub Insert_Blank_Rows()
'Select last row in worksheet.
Selection.End(xlDown).Select
Do Until ActiveCell.Row = 1
'Insert blank row.
ActiveCell.EntireRow.Insert shift:=xlDown
'Move up one row.
ActiveCell.Offset(-1, 0).Select
Loop
End Sub
Does anyone know how I include the 'copying from above' part?
Thank you so much,
Alex
Last edited: