Creating a new blank row and moving data to that row

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 use a macro/vba or whatever I need to in order to allow me to create a blank row above any row which contains the word Totals. I'd then like to move 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 but that may be asking too much. I'm going to post what the report looks like now and what ultimately I would like the report to look like after the changes are made.

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

<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

<tbody>
</tbody>
 
Re: Help creating a new blank row and moving data to that row

In my previous macro, change the IF line to read:

Code:
If Left(Range("A" & i), 6) = "Totals" Then
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Re: Help creating a new blank row and moving data to that row

The macro was able to create the new blank row above all rows with "Totals" in them. Thank you so much for that as it will save a bunch of time. Unfortunately, the description didn't copy over to Row A in the new blank row. The description stayed where it was in Row P.
 
Upvote 0
Re: Help creating a new blank row and moving data to that row

I know I'm asking a lot here but is there also a way to add "Loss Description:" in front of the "Description" data which is moved from Column P to Column A of the newly created blank row? The end result would create the blank row above Totals, which you've already helped me with. Add "Loss Description:" to Column A of the new blank row and then move the "Description" data from Column P to Column A of the new blank row so it looks like "Loss Description: Description".
 
Upvote 0
Re: Help creating a new blank row and moving data to that row

That's odd as it copies over when I run it.

RE: your other question, change the assignment line to:

Code:
Cells(i, 1) = "Loss Description: " & Cells(n + 1, 16).Value
 
Last edited:
Upvote 0
Re: Help creating a new blank row and moving data to that row

We are so close! The code I've used, which you've provided, will be below. Right now, the Description in Column P is still staying in Column P and not moving to the blank row in Column A. After adding your latest code, Loss Description gets added to the newly created blank row. I want to make sure I've entered the code correctly and I'm not missing something simple which is causing the descriptions in Column P not to move to Column A.

Sub InsertAdj()
Dim LR As Long, i As Integer, n As Integer
LR = Cells(Rows.Count, "A").End(xlUp).Row
For i = LR To 2 Step -1
If Left(Range("A" & i), 6) = "Totals" Then
Rows(i).Insert Shift:=xlDown
n = WorksheetFunction.Match(WorksheetFunction.Lookup("zzzzz", Range("A1:A" & i)), Range("A1:A" & i), 0)
Cells(i, 1) = "Loss Description: " & Cells(n + 1, 16).Value
Cells(n + 1, 16).ClearContents
End If
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,183
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