Transposing a list

mlz

New Member
Joined
Jun 23, 2008
Messages
3
I have a list I would like to transpose. Below is an example.

<table x:str="" style="border-collapse: collapse; width: 48pt;" border="0" cellpadding="0" cellspacing="0" width="64"><col style="width: 48pt;" width="64"> <tbody><tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt; width: 48pt;" height="17" width="64">name</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">address</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">tel</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">email</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" x:str="name " height="17">name </td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">address</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">name</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" x:str="address " height="17">address </td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">tel</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" x:str="name " height="17">name </td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">tel</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" x:str="email " height="17">email </td> </tr> </tbody></table>
This is what I would like the macro to do.

<table x:str="" style="border-collapse: collapse; width: 192pt;" border="0" cellpadding="0" cellspacing="0" width="256"><col style="width: 48pt;" span="4" width="64"> <tbody><tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt; width: 48pt;" height="17" width="64">name</td> <td style="width: 48pt;" width="64">address</td> <td style="width: 48pt;" width="64">tel</td> <td style="width: 48pt;" width="64">email</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" x:str="name " height="17">name </td> <td>address</td> <td>
</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">name</td> <td x:str="address ">address </td> <td>tel</td> <td>
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" x:str="name " height="17">name </td> <td>tel</td> <td x:str="email ">email </td> <td>
</td> </tr> </tbody></table>
Currently I am copying and transposing. I tried recording a macro but I have not had luck. In between every contact I have a blank space.
Thanks,
MLZ
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Do you have anything that identifies the entry as to what it is, i.e. does it actually say name, address, tel or e-mail before the entry or is that going to have to be detected by the macro?

Dom
 
Upvote 0
For each contact only the cell with the telephone and email identify the content of the cell.

Thanks,
MLZ
 
Upvote 0
You can try

Code:
Option Explicit
Sub tst()
Dim r As Range, a, i As Integer
Set r = Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
Set r = r.SpecialCells(xlCellTypeConstants)
For i = 1 To r.Areas.Count
a = Split(Join(Application.Transpose(r.Areas(i)), ","), ",")
Cells(i, 2).Resize(1, UBound(a) + 1) = a
Next
End Sub

HTH
 
Upvote 0
This is what it <table x:str="" style="border-collapse: collapse; width: 267px; height: 108px;" border="0" cellpadding="0" cellspacing="0"><col style="width: 171pt;" width="228"> <tbody><tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt; width: 171pt;" height="17" width="228">


PH: 555-555-5555
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">FX: 555-555-5555
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td style="height: 12.75pt;" height="17">EM: bob.hope@hotmail.com</td> </tr> </tbody></table>
 
Upvote 0

Forum statistics

Threads
1,214,596
Messages
6,120,438
Members
448,966
Latest member
DannyC96

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