Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am trying to figure out how to search through column B of Sheet1. If there are duplicates, display a message stating such, with the duplicate value contained in the msgbox. ideas? -- Carlee |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Apr 26, 9:38 pm, Carlee wrote:
Hi, I am trying to figure out how to search through column B of Sheet1. If there are duplicates, display a message stating such, with the duplicate value contained in the msgbox. ideas? -- Carlee Why not sort the data, and then compare one cell with the next? For example Dim currCell Dim nextCell Dim counter Dim a counter = activesheet.range("b2").currentregion.rows.count 'or use usedrange... for a = 1 to counter currCell = range("b" & a).value nextCell = range("b" & a).offset(1,0).value if currCell = nextCell then msgbox prompt:="You have a duplicate." & vbcr _ & "The value is " & currCell & vbcr _ & "The location is " a & " & " & a + 1, buttons:=vbOkOnly end if next Matt |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Apr 26, 9:38 pm, Carlee wrote:
Hi, I am trying to figure out how to search through column B of Sheet1. If there are duplicates, display a message stating such, with the duplicate value contained in the msgbox. ideas? -- Carlee Why not sort the data and then compare one cell with the other? for example (not tested) dim currCell dim nextCell dim counter dim a counter = activesheet.range("b1").currentregion.rows.count 'or use usedrange... for a = 1 to counter currCell = range("b" & a).value nextCell = range("b" & a).offset(1,0).value if currCell = nextCell then msgbox prompt:="You have a duplicate." & vbcr _ & "The value is " & currCell & vbcr _ & "The location is " & a & " & " a + 1, buttons:=vbokonly end if next matt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Search for duplicates across three worksheets | Excel Worksheet Functions | |||
search for duplicates | Excel Programming | |||
how do I search a colum for duplicates automatically | Excel Discussion (Misc queries) | |||
search range for duplicates | Excel Programming | |||
Word Search from Excel results in Duplicates | Excel Programming |