PC Review


Reply
Thread Tools Rate Thread

how to append and remove dups

 
 
TG
Guest
Posts: n/a
 
      18th Jul 2008
hi!

I have the following spreadsheet:

columna columnb columnc columnd
1 AAAA BCBCBC
xyxyxy
1 AAAA DEDEDE
sdsdw
2 DDDDD ghjhedt
jhughu
2 DDDDD
null yujhgf
3 EEEEEE
null ptyergh


I need to append the data from columnc and columnd if the columna
number is the same.

e.g.


columna columnb
columnc columnd
1 AAAA
BCBCBC,DEDEDE xyxyxy,sdsdw
2 DDDDD
ghjhedt,null jhughu,yujhgf
3 EEEEEE
null ptyergh


I have the following code, but it only works for one column of
appending data. How can I modify so that it does it on the 2 columns I
need.
Also how can I check for last row in spreadhseet instead of having to
manually hard code the last row used?

Thanks a lot for your help!!!!!

Tammy


Sub RemoveDuplicates()


For Row = 267 To 2 Step -1
If Cells(Row, "A").Value = Cells(Row - 1, "A").Value Then
s = s & RTrim(LTrim(Cells(Row, "J").Value)) & ";"
Rows(Row).Delete
Else
If s <> "" Then
Cells(Row, "J").Value = s & Cells(Row, "J").Value
s = ""
End If
End If
Next Row

End Sub
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      18th Jul 2008
Sub RemoveDuplicates()

LastRow = Range("A" & Rows.Count).end(xlup).Row
For Row = LastRow To 2 Step -1
If Cells(Row, "A").Value = Cells(Row - 1, "A").Value Then
s = s & RTrim(LTrim(Cells(Row, "J").Value)) & ";"
T = T & RTrim(LTrim(Cells(Row, "K").Value)) & ";"
Rows(Row).Delete
Else
If s <> "" Then
Cells(Row, "J").Value = s & Cells(Row, "J").Value
s = ""
End If
If t <> "" Then
Cells(Row, "K").Value = t & Cells(Row, "K").Value
t = ""
End If
End If
Next Row

End Sub


"TG" wrote:

> hi!
>
> I have the following spreadsheet:
>
> columna columnb columnc columnd
> 1 AAAA BCBCBC
> xyxyxy
> 1 AAAA DEDEDE
> sdsdw
> 2 DDDDD ghjhedt
> jhughu
> 2 DDDDD
> null yujhgf
> 3 EEEEEE
> null ptyergh
>
>
> I need to append the data from columnc and columnd if the columna
> number is the same.
>
> e.g.
>
>
> columna columnb
> columnc columnd
> 1 AAAA
> BCBCBC,DEDEDE xyxyxy,sdsdw
> 2 DDDDD
> ghjhedt,null jhughu,yujhgf
> 3 EEEEEE
> null ptyergh
>
>
> I have the following code, but it only works for one column of
> appending data. How can I modify so that it does it on the 2 columns I
> need.
> Also how can I check for last row in spreadhseet instead of having to
> manually hard code the last row used?
>
> Thanks a lot for your help!!!!!
>
> Tammy
>
>
> Sub RemoveDuplicates()
>
>
> For Row = 267 To 2 Step -1
> If Cells(Row, "A").Value = Cells(Row - 1, "A").Value Then
> s = s & RTrim(LTrim(Cells(Row, "J").Value)) & ";"
> Rows(Row).Delete
> Else
> If s <> "" Then
> Cells(Row, "J").Value = s & Cells(Row, "J").Value
> s = ""
> End If
> End If
> Next Row
>
> End Sub
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Append values and remove text PurpleMilk Microsoft Excel Worksheet Functions 4 14th Dec 2009 07:59 PM
Please help. Remove dups automaic of same name,price,month. =?Utf-8?B?Q1lOVEhJQQ==?= Microsoft Excel Misc 6 29th Aug 2007 10:24 PM
Using mail merge wizard to send emails, how can I remove dups? =?Utf-8?B?SGFycnk=?= Microsoft Outlook Discussion 1 18th Jul 2005 04:04 PM
remove dups from ArrayList DaveF Microsoft ASP .NET 1 21st Nov 2004 10:42 PM
Remove Dups in a ComboBox Popsie Robinson Microsoft Access Forms 3 22nd Sep 2003 07:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:51 PM.