Macro to create a new row and copy data

BigEInMT

New Member
Joined
Jun 24, 2019
Messages
11
I am currently configuring a financial report which lists description data as well as financial data. I will post a copy of the layout below. What I'm looking to do, is to create a macro which would allow me to create a blank row above any row which contains the word Totals. I'd then like to cut the data from Column 15 and paste the data into Column A of the new blank row. I'd also like to Merge the cells from the first column through Column 8 for the new blank row. I'm going to post what the report looks like now and what ultimately I would like the report to look like after the macro is run.

Now:
Column 1Column 2Column 3Column 4Column 5Column 6Column 7Column 8Column 9Column 10Column 11Column 12Column 13Column 14Column 15
Number: 1
DataDataDataDataDataDataDataData$0.00$0.00$0.00$0.00$0.00$0.00Description
DataDataDataDataDataDataDataData$0.00$0.00$0.00$0.00$0.00$0.00
Totals$0.00$0.00$0.00$0.00$0.00$0.00
Number: 2
DataDataDataDataDataDataDataData$0.00$0.00$0.00$0.00$0.00$0.00Description
DataDataDataDataDataDataDataData$0.00$0.00$0.00$0.00$0.00$0.00
DataDataDataDataDataDataDataData$0.00$0.00$0.00$0.00$0.00$0.00
DataDataDataDataDataDataDataData$0.00$0.00$0.00$0.00$0.00$0.00
Totals$0.00$0.00$0.00$0.00$0.00$0.00


<colgroup><col><col span="9"><col span="2"><col span="2"><col><col></colgroup><tbody>
</tbody>

What I'd like it to look like:
Column 1Column 2Column 3Column 4Column 5Column 6Column 7Column 8Column 9Column 10Column 11Column 12Column 13Column 14Column 15
Number: 1
DataDataDataDataDataDataDataData$0.00$0.00$0.00$0.00$0.00$0.00
DataDataDataDataDataDataDataData$0.00$0.00$0.00$0.00$0.00$0.00
Description
Totals$0.00$0.00$0.00$0.00$0.00$0.00
Number: 2
DataDataDataDataDataDataDataData$0.00$0.00$0.00$0.00$0.00$0.00
DataDataDataDataDataDataDataData$0.00$0.00$0.00$0.00$0.00$0.00
DataDataDataDataDataDataDataData$0.00$0.00$0.00$0.00$0.00$0.00
DataDataDataDataDataDataDataData$0.00$0.00$0.00$0.00$0.00$0.00
Description
Totals$0.00$0.00$0.00$0.00$0.00$0.00

<colgroup><col><col span="9"><col span="2"><col span="2"><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Try this

Code:
Sub Create_New_Record()
    Dim u As Long
    Application.ScreenUpdating = False
    For i = Range("A" & Rows.Count).End(xlUp).Row To 1 Step -1
        If LCase(Cells(i, "A").Value) = LCase("Totals") Then
            Cells(i, "A")(2).EntireRow.Insert
            Cells(i, "A")(2).Value = Cells(i, 15).End(xlUp).Value
        End If
    Next
    Application.ScreenUpdating = True
    MsgBox "End"
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,172
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top