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:
<tbody>
</tbody>
What I'd like it to look like:
<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
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 1 | Column 2 | Column 3 | Column 4 | Column 5 | Column 6 | Column 7 | Column 8 | Column 9 | Column 10 | Column 11 | Column 12 | Column 13 | Column 14 | Column 15 | |
Number: 1 | |||||||||||||||
Data | Data | Data | Data | Data | Data | Data | Data | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | Description | |
Data | Data | Data | Data | Data | Data | Data | Data | $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 | |||||||||||||||
Data | Data | Data | Data | Data | Data | Data | Data | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | Description | |
Data | Data | Data | Data | Data | Data | Data | Data | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | ||
Data | Data | Data | Data | Data | Data | Data | Data | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | ||
Data | Data | Data | Data | Data | Data | Data | Data | $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 1 | Column 2 | Column 3 | Column 4 | Column 5 | Column 6 | Column 7 | Column 8 | Column 9 | Column 10 | Column 11 | Column 12 | Column 13 | Column 14 | ||
Number: 1 | |||||||||||||||
Data | Data | Data | Data | Data | Data | Data | Data | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | ||
Data | Data | Data | Data | Data | Data | Data | Data | $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 | |||||||||||||||
Data | Data | Data | Data | Data | Data | Data | Data | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | ||
Data | Data | Data | Data | Data | Data | Data | Data | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | ||
Data | Data | Data | Data | Data | Data | Data | Data | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | ||
Data | Data | Data | Data | Data | Data | Data | Data | $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