Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default combining rows in an excel file

Try some code like the following. Change the lines marked with <<<< to
the appropriate values. StartCell is the first cell of the original
input data. Destination is the first cell of the combined rows.
NumColumns is the number of columns from the input data to copy to the
output data. The code will loop from StartCell downward until a blank
cell is encountered.


Sub AAA()
Dim StartCell As Range
Dim Destination As Range
Dim NumColumns As Long

NumColumns = 3 '<<< CHANGE
Set StartCell = Worksheets("Sheet2").Range("A1") '<<<< CHANGE
Set Destination = Worksheets("Sheet3").Range("A1") '<<<< CHANGE
Do Until StartCell.Value = vbNullString
StartCell.Resize(1, NumColumns).Copy _
Destination:=Destination
StartCell(2, 1).Resize(1, NumColumns).Copy _
Destination:=Destination(1, NumColumns + 1)
Set StartCell = StartCell(3, 1)
Set Destination = Destination(2, 1)
Loop
End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Tue, 17 Feb 2009 12:44:01 -0800, kbonner@wabt
wrote:

I have a report that is downloaded and the customer information is in 2 rows.
I need this combined into one row so that it can be sorted.
Please help

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
Combining multiple rows dagdee New Users to Excel 1 October 22nd 09 12:51 PM
Combining rows LOST Excel Discussion (Misc queries) 4 October 29th 08 05:41 PM
Combining Rows Jim Excel Worksheet Functions 7 March 9th 07 10:27 PM
combining data from several excel files into one file bobman Excel Discussion (Misc queries) 3 March 12th 06 08:34 AM
Combining rows SteveRJ Excel Worksheet Functions 1 June 17th 05 01:02 PM


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