Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How to convert a table to list?

Can anybody help me to convert a table to a list?

For example:

Table:
Red Black
VW 100 20
Toyota 15 50

to become:

List:
VW Red 100
VW Black 20
Toyota Red 15
Toyota Black 50

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default How to convert a table to list?

Here is some VBA to do it

Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long, j As Long
Dim iLastRow As Long
Dim iLastCol As Long

Application.ScreenUpdating = False

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 2 Step -1
iLastCol = .Cells(i, .Columns.Count).End(xlToLeft).Column
For j = iLastCol To 3 Step -1
.Rows(i + 1).Insert
.Cells(i + 1, TEST_COLUMN).Value = .Cells(i,
TEST_COLUMN).Value
.Cells(i + 1, 2).Value = .Cells(i, j).Value
.Cells(i, j).Value = ""
Next j
Next i

.Rows(1).Delete

End With

Application.ScreenUpdating = True

End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"ferdi" wrote in message
...
Can anybody help me to convert a table to a list?

For example:

Table:
Red Black
VW 100 20
Toyota 15 50

to become:

List:
VW Red 100
VW Black 20
Toyota Red 15
Toyota Black 50

Thank you



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert vertical blocked list to horizontal list? G Lykos Excel Worksheet Functions 8 May 17th 23 07:45 PM
How to convert existing Excel List into a table in Access? anna New Users to Excel 2 June 18th 06 11:57 PM
Convert Pivot Table to Normal Data table ashish128 Excel Discussion (Misc queries) 2 May 2nd 06 09:34 AM
Convert excel table to HTML Loïc Excel Discussion (Misc queries) 4 October 17th 05 09:44 PM
convert excel list to pivot table GI Excel Discussion (Misc queries) 0 December 6th 04 06:45 PM


All times are GMT +1. The time now is 06:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"