# finding values from duplicates

1. ## finding values from duplicates

Hi guys..
I got problem..
I have a sheet with details of students with their textbook id and its details. Same sutdent can have different textbookid .
I have to sort the student and remove the duplicates.. but while removing the duplicate student, i have to display all the textbook id in the textbookid column. say..
If the student A got 3 different textbook id (Column say 'M') 32,35,36 in three different rows, while removing , the row of the student A should have column 'M' with the value 32,35,36.. how can o do that .. the function used for duplicate is simple:

Sub RemoveDuplicates()

For Row = 25 To 2 Step -1
If Cells(25,”A”).Value = Cells(Row - 1, “A”).Value Then

Rows(Row).Delete
End If
Next Row
End Sub

2. ## Re: finding values from duplicates

Sub RemoveDuplicates()

For Row = 25 To 2 Step -1
If Cells(row,"A").Value = _
Cells(Row - 1, "A").Value Then
s = s & Cells(row,"M").Value & ", "
Rows(Row).Delete
Else
if s <> "" then
cells(row,"M").Value = s & ", " & _
cells(row,"M").Value
s = ""
end if
End If
Next Row
End Sub

--
Regards,
Tom Ogilvy

"bisjom" <bisjom.22y5nz_1139463002.2226@excelforum-nospam.com> wrote in
message news:bisjom.22y5nz_1139463002.2226@excelforum-nospam.com...
>
> Hi guys..
> I got problem..
> I have a sheet with details of students with their textbook id and its
> details. Same sutdent can have different textbookid .
> I have to sort the student and remove the duplicates.. but while
> removing the duplicate student, i have to display all the textbook id
> in the textbookid column. say..
> If the student A got 3 different textbook id (Column say 'M') 32,35,36
> in three different rows, while removing , the row of the student A
> should have column 'M' with the value 32,35,36.. how can o do that ..
> the function used for duplicate is simple:
>
>
> Sub RemoveDuplicates()
>
> For Row = 25 To 2 Step -1
> If Cells(25,"A").Value = Cells(Row - 1, "A").Value
> Then
>
> Rows(Row).Delete
> End If
> Next Row
> End Sub
>
>
>
>
> --
> bisjom
> ------------------------------------------------------------------------
> bisjom's Profile:

http://www.excelforum.com/member.php...o&userid=31206
>

3. You are brilliant Tom and pretty quick.. I want to do exactly this and i tried it with '+' and other operators... How stupid i am...

I will try and let you know...
Thank you

4. Hi Tom..
It done.. Fantastic...
But there is a little problem.. the column value after removing is like::
10, , 28, , 32. I have to check y this blanl space in between..

But thats minor porblem... thanks very much,,

Na.. i sort it out.. there was coma and a space twice.. its fine now...

I want to print this values to a text box in a userform . that means each textbook id to each textbox. that means ,consider i have a limit of textbook of 10 . i have 10 textboxex , these values in the sheet cell say 10,28,32 should go to each text boxes say txtB1,txtB2,txtB3..

Can i take two charactes each since the id should be of 2 character..

you are wonderful...

5. Hi tom,

I was trying to fix the problem of displaying the data from sheet to form..

it is working fine for one value since i am stucked half way..

The below is the code i have used...
``Please Login or Register  to view this content.``
but I have a problem at(here) :USERFORM1.TXT&(boxno)=qsc(K)
My plan is that give the text boxes names like: txt1,txt2 etc and it should take that value from variable boxno. but it shows error.
If i give that line as USERFORM1.TXT1=qsc(K) , it is displaying the value in it , but all the values are in the same text box and so i will get only one value..

I know its really a silly thing.. i am trying , but really slow..

6. Hi Tom...

Its done...

I changed the code in that line to:
[code]
UserForm1.Controls.Item(boxname + boxno).Text = qsc(k)
[\code]

where boxname is the variable which stored "TXT" and it is taking the textboxname as TXT1,TXT2,TXT3..

thanks Tom...

7. Hi guys...

sorry I need your help again..

I tried the code that i have given before ,it is working fine for one value , but if i put it into the loop, it will work for the first time and it shows 'type mismatch ' error.. do you have any idea,

``Please Login or Register  to view this content.``

8. Hi Guys...
I changed the code where there was :
``Please Login or Register  to view this content.``
+ to & and its fine,,

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1