View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default Search and Combine Rows

On Monday, March 26, 2012 10:20:30 AM UTC-5, ktemplin wrote:
I have a spreadsheet that has multiple rows and two Colums. A1 =
Server name, B1 = email address of the server owner. The problem is
that servers have multiple owners so one server could have 7 rows.
What I would like to do is to concatinate all the email addresses, so
I have one row per server.
For example here is the existing data:
Row = Column1, Column2
Row 1 = Server1,
Row 2 = Server1,

Row 3 = Server1,

Row 4 = Server1,

Row 5 = Server2,

Row 6 = Server2,

Row 7 = Server3,


What I would like to have is:
Row 1 = Server1,
; ;
;
Row 2 = Server2,
;
Row 3 = Row 7 = Server3,


I am not familiar with macros, is there any way of doing this with
functions?

Sub blockstorowsSAS()
Dim i As Long
Dim lc As Long

On Error Resume Next
For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Cells(i + 1, 1) = Cells(i, 1) Then
lc = Cells(i, Columns.Count).End(xlToLeft).Column + 1
Cells(i + 1, 2).Resize(, lc).Copy Cells(i, lc)
Rows(i + 1).Delete
End If
Next i
Columns.AutoFit
End Sub