View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dee Sperling[_2_] Dee Sperling[_2_] is offline
external usenet poster
 
Posts: 29
Default Concatenate and Delete

I've got a spreadsheet with most of the same information on contiguous lines.
I am trying to concatenate all values in 1 specific column and delete the
others after I've added the data to the first row.

For example:
Record Number Action Type Operator Last Name Operator First Name Operator
Mid Init NUMBER
4450 New SMITH JAMES L 12345
4450 New SMITH JAMES L 673425
4450 New SMITH JAMES L 98444D
4450 New SMITH JAMES L 98K7AAA
4706 New JONES TOM 34345Y33
4706 New JONES TOM 98763R
4738 New JONES TOM 13222
4844 New BERBAUM CECELIA 787JU8
4844 New BERBAUM CECELIA 44UY33
4844 New BERBAUM CECELIA POL987
4844 New BERBAUM CECELIA 339999
4844 New BERBAUM CECELIA 999333

I know the code below isn't written correctly, so I'm hoping someone can
tell me how to write it.
'set first row
Set CurrentRow to 2
'Only run the Do until Column B is empty
For Count=1 to (as many rows as have data in column B)
'If the fields in the current row are the same as the one below, then add the
'value from column I in the 2nd row to the value in column I of the current
row.
'Then delete the 2nd row and start over.
Do while (("B" & CurrentRow) & ("D" & CurrentRow) & ("E" & CurrentRow) & "F"
& CurrentRow)) =(("B" & CurrentRow+1) & ("D" & CurrentRow+1) & ("E" &
CurrentRow+1) & "F" & CurrentRow+1))
Set ("I" & CurrentRow) + ("I" & CurrentRow) & " " & ("I" & CurrentRow+1)
Delete CurrentRow+1
Loop
'set the current row to the next row.
CurrentRow = CurrentRow+1
Next

Thank you for your time,
Dee