#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Transposing

COL A has 165,000 cells that looks like this:

CONTROL-NBR 1
DATA1
DATA2
DATA3
CONTROL-NBR 2
DATA1
DATA2
DATA3
DATA4
DATA5
DATA6
CONTROL-NBR 3
DATA1
CONTROL-NBR 4
DATA1
DATA2
DATA3
DATA4
DATA5

How can I transpose the "DATA" cells for each "CONTROL-NBR" onto the
same row as the "CONTROL-NBR" so the result looks like this::

CONTROL-NBR-1 DATA1 DATA2 DATA3



CONTROL-NBR-2 DATA1 DATA2 DATA3 DATA4 DATA5 DATA6






CONTROL-NBR-3 DATA1

CONTROL-NBR-4 DATA1 DATA2 DATA3 DATA4 DATA5






(Note: The number of "DATA" cells for each "CONTROL-NBR" varies from 1
to 30).

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default Transposing

Do the CONTROL-NBR's start with "CONTROL"?
--
-SA


"gary" wrote:

COL A has 165,000 cells that looks like this:

CONTROL-NBR 1
DATA1
DATA2
DATA3
CONTROL-NBR 2
DATA1
DATA2
DATA3
DATA4
DATA5
DATA6
CONTROL-NBR 3
DATA1
CONTROL-NBR 4
DATA1
DATA2
DATA3
DATA4
DATA5

How can I transpose the "DATA" cells for each "CONTROL-NBR" onto the
same row as the "CONTROL-NBR" so the result looks like this::

CONTROL-NBR-1 DATA1 DATA2 DATA3



CONTROL-NBR-2 DATA1 DATA2 DATA3 DATA4 DATA5 DATA6






CONTROL-NBR-3 DATA1

CONTROL-NBR-4 DATA1 DATA2 DATA3 DATA4 DATA5






(Note: The number of "DATA" cells for each "CONTROL-NBR" varies from 1
to 30).


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default Transposing

If CONTROL is at the begining of the data sets, then the following macro
should reorganize your data properly. I tested it on your example data set
and it works. Hope this helps!

Option Explicit
Sub ColToRows()

Dim curselection As Range

Set curselection = Range("A1") 'or wherever you start

Do
If curselection.Offset(0, 1) = "" Then
If Not curselection.Offset(1, 0).Value Like "CONTROL*" Then
curselection.Offset(1, 0).Cut Destination:=curselection.Offset(0, 1)
curselection.Offset(1, 0).EntireRow.Delete
End If
End If
datafound:
If Not curselection.Offset(1, 0).Value Like "CONTROL*" Then
curselection.Offset(1, 0).Cut
Destination:=curselection.End(xlToRight).Offset(0, 1)
curselection.Offset(1, 0).EntireRow.Delete
If curselection.Offset(1, 0) = "" Then Exit Do
GoTo datafound
End If
Set curselection = curselection.Offset(1, 0)
Loop

End Sub
--
-SA


"gary" wrote:

COL A has 165,000 cells that looks like this:

CONTROL-NBR 1
DATA1
DATA2
DATA3
CONTROL-NBR 2
DATA1
DATA2
DATA3
DATA4
DATA5
DATA6
CONTROL-NBR 3
DATA1
CONTROL-NBR 4
DATA1
DATA2
DATA3
DATA4
DATA5

How can I transpose the "DATA" cells for each "CONTROL-NBR" onto the
same row as the "CONTROL-NBR" so the result looks like this::

CONTROL-NBR-1 DATA1 DATA2 DATA3



CONTROL-NBR-2 DATA1 DATA2 DATA3 DATA4 DATA5 DATA6






CONTROL-NBR-3 DATA1

CONTROL-NBR-4 DATA1 DATA2 DATA3 DATA4 DATA5






(Note: The number of "DATA" cells for each "CONTROL-NBR" varies from 1
to 30).


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
need help with transposing [email protected] Excel Discussion (Misc queries) 2 October 30th 08 02:10 PM
Transposing Nanapat Excel Discussion (Misc queries) 2 April 2nd 08 11:38 PM
Transposing Deena Excel Worksheet Functions 2 October 27th 06 05:13 PM
TRANSPOSING merlin Excel Programming 3 September 21st 06 12:56 AM
TRANSPOSING GARY Excel Discussion (Misc queries) 1 March 17th 06 11:09 AM


All times are GMT +1. The time now is 09:49 AM.

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"