Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / April 2008

Tip: Looking for answers? Try searching our database.

Find and delete

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Candy - 15 Apr 2008 10:25 GMT
I Have a range of Numbers

in Col A  ( A1 : A1631 )

in Col B ( B1 : B384 )

I want to delete duplicates that appear in Col A from Col B then delete Col
B

Thus leaving Col A with unique records.

Thanks

In Advance

Karen.
Gary''s Student - 15 Apr 2008 11:07 GMT
This is quite slow, but it works:

Sub dupdel()
Set rdel = Nothing
Set ra = Range("A1:A1631")
Set rb = Range("B1:B384")
For Each rra In ra
   v = rra.Value
   For Each rrb In rb
       If rrb.Value = v Then
           If rdel Is Nothing Then
               Set rdel = rra
           Else
               Set rdel = Union(rdel, rra)
           End If
       End If
   Next
Next
rdel.Delete Shift:=xlUp
End Sub
Signature

Gary''s Student - gsnu2007h

> I Have a range of Numbers
>
[quoted text clipped - 12 lines]
>
> Karen.
Candy - 15 Apr 2008 11:32 GMT
thanks for the reply but what do i do with it

i am not very experienced with excel

thanks

Karen

> This is quite slow, but it works:
>
[quoted text clipped - 34 lines]
>>
>> Karen.
Gary''s Student - 15 Apr 2008 11:56 GMT
The code is called a macro.  Macros are very easy to install and use:

1. ALT-F11  brings up the VBE window
2. ALT-I
   ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1.    ALT-F8
2.    Select the macro
3.    Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

Signature

Gary''s Student - gsnu2007h

> thanks for the reply but what do i do with it
>
[quoted text clipped - 42 lines]
> >>
> >> Karen.
ryguy7272 - 18 Apr 2008 22:12 GMT
This tutorial is quite nice because it has lots of graphics (a picture is
worth 1000 words).
http://www.anthony-vba.kefra.com/vba/vbabasic1.htm#Creating_Your_First_Macro

Regards,
Ryan---

Signature

RyGuy

> The code is called a macro.  Macros are very easy to install and use:
>
[quoted text clipped - 67 lines]
> > >>
> > >> Karen.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.