Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Transpose problem

I have some code that enters sets of 5-row data in column B, with the
sets of data being apart 41 (blank) rows. I would like to transpose
the data so the five rows become one row with five columns and all the
sets of data to appear after each other with no blank rows in-between.
Note that the first set of data can start at any row in the sheet (not
always row 2 as in the example).


Here's what I have
1 A B C
2 a1
3 b1
4 c1
5 d1
6 e1
7
8
9
10 a2
11 b2
12 c2
13 d2
14 e2

Here's what I need

1 A B C D E F G H
2 a1 b1 c1 d1 e1
3 a2 b2 c2 d2 e2
4

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Transpose problem

Sub ABC()
Dim rng As Range
Dim rw As Long, ar As Range
Set rng = Columns(2).SpecialCells(xlConstants)
rw = 2
For Each ar In rng.Areas
ar.Copy
Cells(rw, 3).PasteSpecial xlValues, Transpose:=True
rw = rw + 1
Next
Columns(2).Delete
End Sub

--
Regards,
Tom Ogilvy


"lt" wrote:

I have some code that enters sets of 5-row data in column B, with the
sets of data being apart 41 (blank) rows. I would like to transpose
the data so the five rows become one row with five columns and all the
sets of data to appear after each other with no blank rows in-between.
Note that the first set of data can start at any row in the sheet (not
always row 2 as in the example).


Here's what I have
1 A B C
2 a1
3 b1
4 c1
5 d1
6 e1
7
8
9
10 a2
11 b2
12 c2
13 d2
14 e2

Here's what I need

1 A B C D E F G H
2 a1 b1 c1 d1 e1
3 a2 b2 c2 d2 e2
4


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Transpose problem

Tom, GREATLY appreciated!



Tom Ogilvy wrote:
Sub ABC()
Dim rng As Range
Dim rw As Long, ar As Range
Set rng = Columns(2).SpecialCells(xlConstants)
rw = 2
For Each ar In rng.Areas
ar.Copy
Cells(rw, 3).PasteSpecial xlValues, Transpose:=True
rw = rw + 1
Next
Columns(2).Delete
End Sub

--
Regards,
Tom Ogilvy


"lt" wrote:

I have some code that enters sets of 5-row data in column B, with the
sets of data being apart 41 (blank) rows. I would like to transpose
the data so the five rows become one row with five columns and all the
sets of data to appear after each other with no blank rows in-between.
Note that the first set of data can start at any row in the sheet (not
always row 2 as in the example).


Here's what I have
1 A B C
2 a1
3 b1
4 c1
5 d1
6 e1
7
8
9
10 a2
11 b2
12 c2
13 d2
14 e2

Here's what I need

1 A B C D E F G H
2 a1 b1 c1 d1 e1
3 a2 b2 c2 d2 e2
4



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
Problem in Transpose Hetal Vora[_2_] Excel Discussion (Misc queries) 0 February 9th 09 04:09 PM
Transpose problem Barry Lennox[_2_] Excel Discussion (Misc queries) 4 January 7th 09 07:04 PM
Transpose Problem Hazel Excel Discussion (Misc queries) 3 February 20th 07 05:55 PM
Not exactly a transpose problem Wibs Excel Discussion (Misc queries) 5 June 15th 06 11:49 AM
Transpose Problem JA Excel Programming 5 June 4th 04 08:57 AM


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