View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default VB Macro for concatenating data...

Sub Test()
Dim iLastRow As Long
Dim iLastCol As Long
Dim i As Long
Dim j As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = iLastRow To 2 Step -1
If Cells(i, "A").Value = Cells(i - 1, "A").Value Then
iLastCol = Cells(i, Columns.Count).End(xlToLeft).Column
For j = 2 To iLastCol
If Cells(i, j).Value < "" Then
Cells(i - 1, j).Value = Cells(i, j).Value
End If
Next j
Rows(i).Delete
End If
Next i

End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"rivvorz" wrote in
message ...

Hi all,

I have a spreadsheet along the following lines:

Id Attrib 1 Attrib 2 Attrib 3 ...
1 x
1 x
1 x
2 x
2 x
3 x
3 x

I need to 'condense' this, i.e. reduce the replication of information-
represent the binary flags under 1 id:

Id Attrib 1 Attrib 2 Attrib 3 ...
1 x x x
2 x x
3 x x

Is this doable by VB macro? I have tired all sorts of other ways of
manipulating the data, but I am stuck using excel and would greatly
appreciate any help someone might give me.

Thanks in advance!


--
rivvorz
------------------------------------------------------------------------
rivvorz's Profile:

http://www.excelforum.com/member.php...o&userid=33450
View this thread: http://www.excelforum.com/showthread...hreadid=532584