Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VB Macro for concatenating data...


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



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
concatenating TED Excel Worksheet Functions 3 February 13th 09 01:03 AM
Need Macro for concatenating multiple worksheet Scott Campbell[_2_] Excel Discussion (Misc queries) 1 March 29th 07 03:04 AM
Concatenating % confused Excel Discussion (Misc queries) 2 September 21st 06 03:49 AM
After concatenating data, how do I get Excel to recognise date? Anisette Excel Discussion (Misc queries) 9 December 29th 05 07:15 PM
Concatenating Metalteck New Users to Excel 10 May 4th 05 01:01 AM


All times are GMT +1. The time now is 02:41 AM.

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"