Macro to rearrange structure of report.

Carl_H

New Member
Joined
Sep 16, 2014
Messages
18
Hello,

Is it possible to change the structure of this report:

2nia59i.jpg



To look like this:
2924avk.jpg
[/IMG]

if anyone can help me I would be very grateful.

My report has a lot more rows than above but the columns are the same.
 
Hello again,
The macro has worked perfectly for my Swedish data. however when using it for some other countries the first letter of the cost center text is not included after running the macro. Could you please adjust the macro to correct this. thank you very much.

Rawdata:
Act. per 8</SPAN>Plan. per 8</SPAN>Var. per 8</SPAN>Cost centers/Cost elements</SPAN>Act per 01 - 8</SPAN>Plan version 0</SPAN>
501102 Husleje udgift</SPAN>
561601 Værkstedsvogne , forsikring</SPAN>
564902 Demo/test - diverse (Vogn på serviceskol</SPAN>
591807 Training material</SPAN>
594006 Customer events</SPAN>
615002 Tryksager</SPAN>
659103 Costs of training GC - Serviceskolen</SPAN>
659214 Costs of training NGC - Serviceskolen KB</SPAN>
659901 Recharge hired services</SPAN>
659904 Recharge techn. training to dealers - Se</SPAN>
701111 Timeløn faste medarb Timeløn / gager</SPAN>
732102 Kørepenge</SPAN>
* 7024 CD, Technical Training</SPAN>
659103 Costs of training GC - Serviceskolen</SPAN>
659901 Recharge hired services</SPAN>
659908 Recharge commercial training - Service S</SPAN>
* 7025 CD, COMMERCIAL TRAINING</SPAN>
609901 Support - VLBD</SPAN>
* 7030 Human Resources, regional</SPAN>

<TBODY>
</TBODY><COLGROUP><COL><COL><COL><COL><COL><COL></COLGROUP>


Output from macro

Act. per X</SPAN>Plan. per X</SPAN>Var. per X</SPAN>Cost center</SPAN>Cost center text</SPAN>Cost element</SPAN>Cost element text</SPAN>Act per X - X</SPAN>Plan version X</SPAN>
7024</SPAN>D, Technical Training</SPAN>501102</SPAN>Husleje udgift</SPAN>
7024</SPAN>D, Technical Training</SPAN>561601</SPAN>Værkstedsvogne , forsikring</SPAN>
7024</SPAN>D, Technical Training</SPAN>564902</SPAN>Demo/test - diverse (Vogn på serviceskol</SPAN>
7024</SPAN>D, Technical Training</SPAN>591807</SPAN>Training material</SPAN>
7024</SPAN>D, Technical Training</SPAN>594006</SPAN>Customer events</SPAN>
7024</SPAN>D, Technical Training</SPAN>615002</SPAN>Tryksager</SPAN>
7024</SPAN>D, Technical Training</SPAN>659103</SPAN>Costs of training GC - Serviceskolen</SPAN>
7024</SPAN>D, Technical Training</SPAN>659214</SPAN>Costs of training NGC - Serviceskolen KB</SPAN>
7024</SPAN>D, Technical Training</SPAN>659901</SPAN>Recharge hired services</SPAN>
7024</SPAN>D, Technical Training</SPAN>659904</SPAN>Recharge techn. training to dealers - Se</SPAN>
7024</SPAN>D, Technical Training</SPAN>701111</SPAN>Timeløn faste medarb Timeløn / gager</SPAN>
7024</SPAN>D, Technical Training</SPAN>732102</SPAN>Kørepenge</SPAN>
7025</SPAN>D, COMMERCIAL TRAINING</SPAN>659103</SPAN>Costs of training GC - Serviceskolen</SPAN>
7025</SPAN>D, COMMERCIAL TRAINING</SPAN>659901</SPAN>Recharge hired services</SPAN>
7025</SPAN>D, COMMERCIAL TRAINING</SPAN>659908</SPAN>Recharge commercial training - Service S</SPAN>
7030</SPAN>uman Resources, regional</SPAN>609901</SPAN>Support - VLBD</SPAN>

<TBODY>
</TBODY><COLGROUP><COL><COL><COL><COL><COL><COL><COL><COL><COL></COLGROUP>
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
A slight amendment:

Rich (BB code):
ShNew.Range("D" & First & ":D" & r - 1).Value = Mid(WorksheetFunction.Trim(.Range("D" & i).Value), 3, 4)
ShNew.Range("E" & First & ":E" & r - 1).Value = Mid(WorksheetFunction.Trim(.Range("D" & i).Value), 8)
 
Upvote 0
A slight amendment:

Rich (BB code):
ShNew.Range("D" & First & ":D" & r - 1).Value = Mid(WorksheetFunction.Trim(.Range("D" & i).Value), 3, 4)
ShNew.Range("E" & First & ":E" & r - 1).Value = Mid(WorksheetFunction.Trim(.Range("D" & i).Value), 8)

Perfect. Thanks again!
 
Upvote 0

Forum statistics

Threads
1,215,236
Messages
6,123,799
Members
449,127
Latest member
Cyko

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