Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jbg jbg is offline
external usenet poster
 
Posts: 16
Default transpose variable array

Hi,
Please, I need some help with the following formula/macro. I want the data
in columns Cat1, Cat2 and Cat3 to be transposed into one single column
("List" column on the left), but the lenght of the array being transposed
should vary based on the Cat Count column. I am putting an example below in
case it helps.
Thanks very much.

List Cat count Cat 1 Cat 2 Cat 3
A 1 A
B 2 B A
A 0
0
B 3 B A C
A 0
C 0

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default transpose variable array

I think this is what you want:
Sub settupp()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Activate
n = Cells(Rows.Count, 1).End(xlUp).Row
k = 1
For i = 1 To n
fst = Cells(i, 1).Value
For j = 1 To 5
snd = Cells(i, j).Value
s2.Cells(k, 1) = fst
s2.Cells(k, 2) = snd
k = k + 1
Next
Next
End Sub

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"JBG" wrote:

Hi,
Please, I need some help with the following formula/macro. I want the data
in columns Cat1, Cat2 and Cat3 to be transposed into one single column
("List" column on the left), but the lenght of the array being transposed
should vary based on the Cat Count column. I am putting an example below in
case it helps.
Thanks very much.

List Cat count Cat 1 Cat 2 Cat 3
A 1 A
B 2 B A
A 0
0
B 3 B A C
A 0
C 0

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
Transpose a variable length list [email protected] Excel Programming 3 December 5th 08 02:39 AM
Transpose array sum SnoHo71 Excel Worksheet Functions 2 January 9th 08 10:52 PM
Using Transpose from within VBA with 256 array Renate[_2_] Excel Programming 4 March 9th 07 02:00 PM
Transpose Array drbobsled Excel Discussion (Misc queries) 1 December 1st 06 01:50 AM
variable transpose [email protected] Excel Programming 0 December 27th 05 01:49 PM


All times are GMT +1. The time now is 12:45 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"