Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Comparing 2 rows for duplicate data

Hello,

Can someone please help me. Im looking for a Macro that will sca
through columns A - B for matching entries and delete those it finds i
column A.

___A___B__
1.| N | H |
2.| B | I |
3.| C | J |
4.| D | K |
5.| E | L |
6.| F | M |
7.| G | N |<--- N found deleting duplicate in cell A1

Thanks

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default Comparing 2 rows for duplicate data

Just so that I understand, you want to delete any value in
column B that is found in Column A. Is that correct?

Sub Sample()
Set ColAValues = ActiveSheet.Range("A1:A" &
ActiveSheet.Range("A65536").End(xlUp).Row)
ColBLastRow = ActiveSheet.Range("B65536").End(xlUp).Row

For i = ColBLastRow To 1 Step -1
CurrentValue = ActiveSheet.Cells(i, 2).Value
For Each Cell In ColAValues
If Cell.Value = CurrentValue Then
ActiveSheet.Cells(i, 2).Delete shift:=xlUp
End If
Next Cell
Next i
End Sub

-----Original Message-----
Hello,

Can someone please help me. Im looking for a Macro that

will scan
through columns A - B for matching entries and delete

those it finds in
column A.

___A___B__
1.| N | H |
2.| B | I |
3.| C | J |
4.| D | K |
5.| E | L |
6.| F | M |
7.| G | N |<--- N found deleting duplicate in cell A1

Thanks,


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Comparing 2 rows for duplicate data

Hello thanks for the help this is exacly what I wanted. I'm going try i
now.

Thank you so much,
Bria

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Comparing 2 rows for duplicate data

Hi Tod,

I just tried the macro and I get this error message.

Compile Error
Syntax Error

Also this portion of your code is highlighted in red

Set ColAValues=ActiveSheet.Range("A1:A" &
ActiveSheet.Range("A65536").End(xlUp).Row)

These are the steps I took to create your macro

I went to Tools, Macro, Visual Basic Editor, Insert, Module and paste
the code into the large white window and then pressed the play button

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Comparing 2 rows for duplicate data

bkbri,
change
Set ColAValues=ActiveSheet.Range("A1:A" &
ActiveSheet.Range("A65536").End(xlUp).Row)
to
Set ColAValues=ActiveSheet.Range("A1:A" & _
ActiveSheet.Range("A65536").End(xlUp).Row)
to run the macro
from your worksheet
ToolsMacro(select the macro you want run and click run)
Cecil

"bkbri " wrote in message
...
Hi Tod,

I just tried the macro and I get this error message.

Compile Error
Syntax Error

Also this portion of your code is highlighted in red

Set ColAValues=ActiveSheet.Range("A1:A" &
ActiveSheet.Range("A65536").End(xlUp).Row)

These are the steps I took to create your macro

I went to Tools, Macro, Visual Basic Editor, Insert, Module and pasted
the code into the large white window and then pressed the play button.


---
Message posted from http://www.ExcelForum.com/



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
comparing data in different rows Daniel Excel Worksheet Functions 4 July 8th 08 12:54 AM
comparing lists of data to remove duplicate data Tom Excel Discussion (Misc queries) 2 October 13th 05 06:16 PM
Comparing rows of data in two worksheets bogeyinsf Excel Programming 1 July 19th 04 01:02 AM
Comparing rows of data in two worksheets Mark Excel Programming 0 April 9th 04 07:01 PM
Comparing rows of data in two worksheets Volker Hormuth Excel Programming 0 April 3rd 04 04:54 PM


All times are GMT +1. The time now is 03:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"