Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Combining multiple rows | New Users to Excel | |||
Combining rows | Excel Discussion (Misc queries) | |||
Combining Rows | Excel Worksheet Functions | |||
combining data from several excel files into one file | Excel Discussion (Misc queries) | |||
Combining rows | Excel Worksheet Functions |