LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Check for duplicate values

What VB macro code can be used to check for duplicate values AFTER all
entries are made into a column instead of as they are being entered? I am
running Microsoft Visual Basic 6.5 in Office 2002. I found the code below,
written by Ardus Petus, that checks for duplicate values AS THEY ARE ENTERED:

'----------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'Adjust next constant to your own needs
Const myColumn As String = "B"
Dim rng As Range
Dim Found As Range

Set rng = Columns(myColumn)
If Intersect(Target, rng) Is Nothing Then Exit Sub
Set Found = rng.Find(Target.Value)
If Found.Address < Target.Address Then MsgBox ("Duplicate code")
End Sub
'-----------------------------------

 
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
Duplicate check Robzz Excel Worksheet Functions 4 May 5th 09 02:41 PM
Check for Duplicate winnie123 Excel Programming 6 May 2nd 09 08:40 PM
Loop through column(s) to check values, perform action based on check ward376 Excel Programming 4 November 6th 07 03:21 PM
How to check for duplicate values within a column Andrew[_56_] Excel Programming 1 September 24th 07 03:53 PM
Check for duplicate values? Ed Excel Programming 7 January 9th 06 04:29 PM


All times are GMT +1. The time now is 08:27 AM.

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"