Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Find and delete

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Find and delete

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
--
Gary''s Student - gsnu2007h


"Candy" wrote:

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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Find and delete

thanks for the reply but what do i do with it

i am not very experienced with excel


thanks

Karen


"Gary''s Student" wrote in message
...
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
--
Gary''s Student - gsnu2007h


"Candy" wrote:

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.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Find and delete

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

--
Gary''s Student - gsnu2007h


"Candy" wrote:

thanks for the reply but what do i do with it

i am not very experienced with excel


thanks

Karen


"Gary''s Student" wrote in message
...
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
--
Gary''s Student - gsnu2007h


"Candy" wrote:

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.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Find and delete

This tutorial is quite nice because it has lots of graphics (a picture is
worth 1000 words).
http://www.anthony-vba.kefra.com/vba...ur_First_Macro

Regards,
Ryan---

--
RyGuy


"Gary''s Student" wrote:

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

--
Gary''s Student - gsnu2007h


"Candy" wrote:

thanks for the reply but what do i do with it

i am not very experienced with excel


thanks

Karen


"Gary''s Student" wrote in message
...
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
--
Gary''s Student - gsnu2007h


"Candy" wrote:

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.






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
Find and Delete Row Keyrookie Excel Worksheet Functions 1 October 16th 07 08:33 PM
Find and Replace - delete the remainder of the text in the cell after my Find [email protected] Excel Programming 4 August 4th 07 03:39 AM
find and delete duplicate entries in two columns or find and prin. campare 2 columns of numbers-find unique Excel Programming 1 November 24th 04 04:09 PM
find and delete text, find a 10-digit number and put it in a textbox Paul Excel Programming 3 November 16th 04 04:21 PM
VBA to Find & Delete Dave[_16_] Excel Programming 3 July 17th 03 09:55 AM


All times are GMT +1. The time now is 06:05 PM.

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"