Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 17
Default Transposing rows into columns

Afternoon all:

I have some data that looks like this:

1st col 2nd col 3rd col
42463 4C 7
42471 V8 2
42473 H6 2
42475 S7 24
42482 4C 169
42482 6D 180
42482 YD 5
42483 4C 225
42483 4C 142
42483 X1 41
42484 4C 84
42484 YD 5

What I would like to do is run a macro that takes multiple entries and
consolidates them onto one line. Like outlined below:

42471 V8 2
42473 H6 2
42475 S7 24
42482 4C 169 6D 180 YD 5
42483 4C 225 4C 142 X1 41
42484 4C 84 YD 5

  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 192
Default Transposing rows into columns

I tested this on your example and it works! Mind any text wrapping
(hopefully it doesn't).

Option Explicit
Sub ColToRow()

Dim curselection As Range

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

Do Until curselection = ""
duplicatefound:
If curselection = curselection.Offset(1, 0) Then
curselection.Offset(1, 1).Cut
Destination:=curselection.End(xlToRight).Offset(0, 1)
curselection.Offset(1, 2).Cut
Destination:=curselection.End(xlToRight).Offset(0, 1)
curselection.Offset(1, 0).EntireRow.Delete
GoTo duplicatefound
End If
Set curselection = curselection.Offset(1, 0)
Loop

End Sub

--
-SA


"RobM" wrote:

Afternoon all:

I have some data that looks like this:

1st col 2nd col 3rd col
42463 4C 7
42471 V8 2
42473 H6 2
42475 S7 24
42482 4C 169
42482 6D 180
42482 YD 5
42483 4C 225
42483 4C 142
42483 X1 41
42484 4C 84
42484 YD 5

What I would like to do is run a macro that takes multiple entries and
consolidates them onto one line. Like outlined below:

42471 V8 2
42473 H6 2
42475 S7 24
42482 4C 169 6D 180 YD 5
42483 4C 225 4C 142 X1 41
42484 4C 84 YD 5

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 17
Default Transposing rows into columns

Thanks for the help SA

"StumpedAgain" wrote:

I tested this on your example and it works! Mind any text wrapping
(hopefully it doesn't).

Option Explicit
Sub ColToRow()

Dim curselection As Range

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

Do Until curselection = ""
duplicatefound:
If curselection = curselection.Offset(1, 0) Then
curselection.Offset(1, 1).Cut
Destination:=curselection.End(xlToRight).Offset(0, 1)
curselection.Offset(1, 2).Cut
Destination:=curselection.End(xlToRight).Offset(0, 1)
curselection.Offset(1, 0).EntireRow.Delete
GoTo duplicatefound
End If
Set curselection = curselection.Offset(1, 0)
Loop

End Sub

--
-SA


"RobM" wrote:

Afternoon all:

I have some data that looks like this:

1st col 2nd col 3rd col
42463 4C 7
42471 V8 2
42473 H6 2
42475 S7 24
42482 4C 169
42482 6D 180
42482 YD 5
42483 4C 225
42483 4C 142
42483 X1 41
42484 4C 84
42484 YD 5

What I would like to do is run a macro that takes multiple entries and
consolidates them onto one line. Like outlined below:

42471 V8 2
42473 H6 2
42475 S7 24
42482 4C 169 6D 180 YD 5
42483 4C 225 4C 142 X1 41
42484 4C 84 YD 5

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
Transposing columns to rows MosheMo Excel Discussion (Misc queries) 3 March 31st 08 02:00 AM
Pasting /transposing from rows to columns. [email protected] Excel Discussion (Misc queries) 1 February 14th 08 07:40 PM
Transposing Rows and Columns Using Paste Special TLW Excel Discussion (Misc queries) 1 October 11th 07 04:41 PM
Transposing three columns into one row after manipulating data in columns digitaldon Excel Discussion (Misc queries) 1 November 20th 06 11:35 PM
Transposing Repeat Rows Into Consolidated Columns Rich F Excel Discussion (Misc queries) 7 August 18th 06 08:38 PM


All times are GMT +1. The time now is 03:33 PM.

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

About Us

"It's about Microsoft Excel"