Macro help (copy last row of item and paste into blank row)

Closed
Jackson - 16 Nov 2014 à 01:34
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 16 Nov 2014 à 05:54
Hello! I need help with creating a macro. Currently I have a macro which creates a blank row everytime an item code in column A changes. Instead of just creating a blank row I want it to instead copy and paste the last row of an item code and bold it into the blank row. For example, I have a bunch of item codes like this
9e393 qty 2 cost 20
9e393 qty 4 cost 40
9e393 qty 5 cost 50

9bcd3 qty 2 cost 30
9bcd3 qty 4 cost 60
9bcd3 qty 6 cost 90

I want it to copy and paste the last row of data of each item code into a blank row after it.
my current macro code is
Dim iRow As Integer
Range("a1").Select
'
iRow = 1
'
Do
'
If Cells(iRow + 1, 1) <> Cells(iRow, 1) Then
Cells(iRow + 1, 1).EntireRow.Insert shift:=xlDown
iRow = iRow + 2
Else
iRow = iRow + 1
End If
'
Loop While Not Cells(iRow, 1).Text = ""
Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 766
16 Nov 2014 à 05:54
Why not make use of macro recorder here. start the recorder
insert a black row. copy row and paste and make it bold. stop recorder. that will giveu template, that u can use to see how to copy, paste and make bold.