help with some code

J

JayJay

Hi i have a sheet and i want to write some VBA so i can check if some
values are present

data is for example

A
408
467
410

i want to check if the data in column A is in another list of data, if
so call some other function, if not another it all must be checked at
once as I will be attaching this to a command button


cheers in advance cos I know u guys/girls are helpfull :)
 
F

Frank Kabel

Hi
try somtehing like the following (the list to be compared is in column
B):
sub foo()
dim t_rng as range
dim cell as range
dim s_rng as range
Dim ret_value

with activesheet
set t_rng=.range("B1:B100")
set s_rng = .range("A1:A10")
end with
for each cell in s_rng
ret_value=application.countif(t_rng,cell.value)
if ret_value>0 then
exit for
end if
next

if ret_value>0
'start one function
else
'another function call
end if
end sub
 
Top