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

Closed
Jackson - Nov 16, 2014 at 01:34 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Nov 16, 2014 at 05:54 AM
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 January 28, 2010 Status Contributor Last seen May 5, 2022 766
Nov 16, 2014 at 05:54 AM
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.
0