Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / September 2007

Tip: Looking for answers? Try searching our database.

Transpose & Split a Column into multiple Rows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
iridius - 21 Sep 2007 13:32 GMT
I have  a spreadsheet with data in Column A.
Each particular collection of data is seperated by a single empty row
in Column A.
Each particular collection of data ranges from 1 row of data to 10 or
more rows of data.

I need to get the data so that each particular collection of data is
on a seperate row.
I want the first piece of data from each seperate collection to be in
Column A, the second in Column B.  But each new collection of data
must start on a new row.

Below is a short bit of what I have followed by what I want.

********************** I HAVE***********************
United States

Alabama

University of Alabama
School of Medicine
Medical Student Services
VH 100
1530 Third Avenue South
Birmingham, AL 35294-0019
E-mail:
medschool@uab.edu
(205) 934-2330
AMCAS // Deadline Information // Public

University of South Alabama
College of Medicine
Office of Admissions, 241 CSAB
Mobile, AL 36688-0002
(334) 460-7176 //
AMCAS // Deadline Information // Public

Arizona

******************* I WANT (I put ............. to imply the row
continues in Excel *******************
United States
Alabama
University of Alabama | School of Medicine | Medical Student
Services .................
University of South Alabama | College of Medicine | Office of
Admissions, 241 CSAB..............
Arizona
Dave Peterson - 21 Sep 2007 16:12 GMT
You could use a macro.

This assumes that there are no formulas in column A--it's all just values.

Option Explicit
Sub testme()
   Dim BigRng As Range
   Dim SmallArea As Range
   Dim wks As Worksheet
   
   Set wks = Worksheets("sheet1")
   
   With wks
       Set BigRng = Nothing
       On Error Resume Next
       Set BigRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp)) _
                        .Cells.SpecialCells(xlCellTypeConstants)
       On Error GoTo 0
       
       If BigRng Is Nothing Then
           MsgBox "No constants in column A!"
           Exit Sub
       End If
       
       For Each SmallArea In BigRng.Areas
           SmallArea.Copy
           SmallArea.Cells(1).Offset(0, 1).PasteSpecial Transpose:=True
       Next SmallArea
       
       On Error Resume Next
       .Range("b1").EntireColumn.Cells _
            .SpecialCells(xlCellTypeBlanks).EntireRow.Delete
       On Error GoTo 0
       
       .Range("a1").EntireColumn.Delete
   End With
       
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

> I have  a spreadsheet with data in Column A.
> Each particular collection of data is seperated by a single empty row
[quoted text clipped - 44 lines]
> Admissions, 241 CSAB..............
> Arizona

Signature

Dave Peterson

iridius - 22 Sep 2007 02:18 GMT
> You could use a macro.
>
[quoted text clipped - 91 lines]
>
> - Show quoted text -

Thanks that worked great, and it was one of the first macros I've had
that had no errors 1st go.... thanks.
Dave Peterson - 22 Sep 2007 02:36 GMT
Well, there were errors in the code before I posted it! <vbg>

Glad it worked for you.

> Thanks that worked great, and it was one of the first macros I've had
> that had no errors 1st go.... thanks.

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.