transpose of data from columns to multiple row with reference to specific data

Neel_07ee55

New Member
Joined
Sep 21, 2016
Messages
2
Hello All,

Below is my input table:

Compound Folder NameFile name
electrical documentsa.pdf
electrical documentsb.dwg
electrical documentsc.pdf
electrical documentsd.xyz
mechanical documentsa1.pdf
mechanical documentsb1.dwg
instrumentation documentsa2.pdf
instrumentation documentsb2.dwg

<colgroup><col><col></colgroup><tbody>
</tbody>

















I want result as stated below:

Compound Folder NameFile name1File name2File name3File name4
electrical documentsa.pdfb.dwgc.pdfd.xyz
mechanical documentsa1.pdfb1.dwg
instrumentation documentsa2.pdfb2.dwg

<colgroup><col><col><col span="3"></colgroup><tbody>
</tbody>


Note:

Count of "Compound Folder Name"/"File Name" may vary.

Kindly provide macro/VBA program for the same.

Thank you & Regards,
Neelkumar Solanki
Electrical Engineer
India
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Try this, for results on sheet2.
Code:
[COLOR="Navy"]Sub[/COLOR] MG21Sep19
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, Temp [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String,[/COLOR] c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Ac [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
[COLOR="Navy"]If[/COLOR] Not Dn.Value = Temp [COLOR="Navy"]Then[/COLOR] c = c + 1: Ac = 0
    [COLOR="Navy"]With[/COLOR] Sheets("Sheet2")
        .Range("A" & c) = Dn.Value
            Ac = Ac + 1
        .Range("A" & c).Offset(, Ac) = Dn.Offset(, 1).Value
        .Range("A1").Offset(, Ac) = "Name" & Ac
    [COLOR="Navy"]End[/COLOR] With
Temp = Dn.Value
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,215,523
Messages
6,125,317
Members
449,218
Latest member
Excel Master

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