Macro to move data to a new row

BigEInMT

New Member
Joined
Jun 24, 2019
Messages
11
Hello,

I am in the process of trying to move data within Column 15 of my Excel Spreadsheet to a new row. I will post what the Excel spreadsheet originally looks like and what I would like the end result to look like. I'll also post the Macro which I've put together. The issue right now is that I can get the header from column 15 to move to the appropriate area but the Description won't cut and paste to where I need it to. The examples of the spreadsheet and Macro are:

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 14
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
Column 15 Header: 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
Column 15 Header: Description
Totals$0.00$0.00$0.00$0.00$0.00$0.00

<tbody>
</tbody>


Macro:
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
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Why do you use
Cells(n + 1, 16).Value
when you want it to come from column 15?

I must compliment you with the clear explanation of the issue.

Please enclose code in code tags (see below)
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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