Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Excel data content listed in 3 columns into a single column

My speadsheet looks like this:
Name Computer name count
Jones cpu1 5
Jones cpu2 6
Jones cpu4 15

I need for it to appear like this:
Name Computer name count
Jones cpu1,cpu2 and cpu4 26

How can this be accomplished. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Copy Excel data content listed in 3 columns into a singlecolumn

Try the macro below.

To use the macro:
1) Have the data sorted by the "Name" column.
2) Select any cell in your data
3) Run the macro

'-------------------------
Sub combine_rows()
Dim tmp As Single, tmp2$

tmp2 = Selection.Range("A1").CurrentRegion.Address(False, False)

With ActiveSheet.Range(tmp2).Columns(1)
If .Rows.Count = 2 Then
For tmp = .Rows.Count To 2 Step -1
If .Rows(tmp).Value = .Rows(tmp - 1).Value Then
.Rows(tmp - 1).Offset(0, 1).Value = _
.Rows(tmp - 1).Offset(0, 1).Value & ", " & _
.Rows(tmp).Offset(0, 1).Value
.Rows(tmp - 1).Offset(0, 2).Value = _
.Rows(tmp - 1).Offset(0, 2).Value + _
.Rows(tmp).Offset(0, 2).Value
.Rows(tmp).EntireRow.Delete
End If
Next
End If
End With
End Sub
'-------------------------

Regards,
Edwin Tam

http://www.vonixx.com



On 1/12/05 11:33 AM, in article
, "mooorrona"
wrote:

My speadsheet looks like this:
Name Computer name count
Jones cpu1 5
Jones cpu2 6
Jones cpu4 15

I need for it to appear like this:
Name Computer name count
Jones cpu1,cpu2 and cpu4 26

How can this be accomplished. Thanks.


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
Copy Multiple Columns, Paste Under a Single column Sriram Excel Worksheet Functions 12 April 4th 23 11:37 AM
I would like to copy UNIQUE data from a column in a SINGLE CELL Yogi Excel Discussion (Misc queries) 2 July 14th 07 07:20 AM
How do I print a single column of data in two columns on one page Neal Excel Discussion (Misc queries) 1 January 8th 06 11:31 PM
how to convert multiple columns of data into one single column? Ah 3 Excel Worksheet Functions 1 November 12th 04 02:33 PM
Move Different Columns of Data to Single Column. willik Excel Programming 2 February 27th 04 01:42 PM


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