Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Validation check

hi all
i have created a very long drop list (25 values) for validating all
cells on column E, the same list appears on all the cells on the
columns G,I,K,M... and so forth.
is there a code that can check if in a row 2 or more cells in the
relevant columns contain the same Value.
and in such a case, for exmple change the color of the cells with the
same values.
thanks guy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Validation check

Is there a possibilty that columns that are not checked (F, H, J, etc) will
have duplicate values as well? If not, the problem is fairly easy. If they
could, then it becomes more complex. this assumes the simpler case:

Sub FindDupes()
Dim cell as range, rng as Range
Dim cell1 as Range, rng1 as Range
set rng = Range("E2",Cells(rows.count,"E").End(xlup))
for each cell in rng
set rng1 = cell.resize(1,20) '<== change the 20
for each cell1 in rng1
if cell1.column mod 2 = 1 then
if application.countif(rng1,cell1) 1 then
cell1.Interior.ColorIndex = 3
else
cell1.Interior.ColorIndex = xlNone
end if
end if
Next cell1
Next cell
End sub

Change the 20 to reflect the number of columns to check.

--
Regards,
Tom Ogilvy


"Guye" wrote:

hi all
i have created a very long drop list (25 values) for validating all
cells on column E, the same list appears on all the cells on the
columns G,I,K,M... and so forth.
is there a code that can check if in a row 2 or more cells in the
relevant columns contain the same Value.
and in such a case, for exmple change the color of the cells with the
same values.
thanks guy


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Validation check

hi,
it gives me the following bug
Unable to set the Colorindex property of interior class
thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Validation check

hi,
its the simple case
regards, guy

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Validation check

It ran like a champ for me against dummy data I would consider consistent
with your explanation. Hopefully you haven't done something silly like
protecting your worksheet.

--
Regards,
Tom Ogilvy



"Guye" wrote:

hi,
it gives me the following bug
Unable to set the Colorindex property of interior class
thanks




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Validation check

hi
its true, i have protected it.
when i unprotected it, it worked.
regards guy


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
Check Box and Validation of a cell leerem Excel Discussion (Misc queries) 2 February 27th 10 01:49 AM
VB Data Validation check Bony Pony[_3_] Excel Discussion (Misc queries) 1 October 8th 09 02:46 PM
How to check whether Cell has Validation? Joe HM Excel Programming 2 January 4th 07 06:53 PM
Check validation on SelectionChange [email protected] Excel Programming 1 June 29th 06 06:03 PM
Problem with validation check! Neo1 Excel Worksheet Functions 4 March 19th 06 03:28 AM


All times are GMT +1. The time now is 08:23 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"