Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help with some code

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 :)



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default help with some code

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_value0 then
exit for
end if
next

if ret_value0
'start one function
else
'another function call
end if
end sub


--
Regards
Frank Kabel
Frankfurt, Germany


JayJay wrote:
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 :)


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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM
VBA code delete code but ask for password and unlock VBA protection WashoeJeff Excel Programming 0 January 27th 04 07:07 AM


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