Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Find method example

Hi All!

I need to find out if certain names exist in Worksheets
("Data").Range("A1:A300") in my application.
It should give boolean answer True or False.

So I would like to use "Find method" but I could not find
much answer in help file or MSDN library.

Can anyone tell me how to use find method please?

Thanks in advance,
Shinichi
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Find method example

Shinichi,

I like to use the CountIf function. (It has few if any errors)
Dim nm As String, x As Integer
nm = "z"
x = WorksheetFunction.CountIf(Sheets("sheet2").Range(" A1:A300"), nm)
If x = 0 Then
MsgBox (nm & " not found")
Else
MsgBox (x & " occurance(s) of " & nm & " found")
End If

You can use a For .... Next loop to cycle through a list of names.
Or you can use an Input box for the user to enter a name to search for.
Amend the code to return True or False.

You could build this into a Function instead of a Sub.
--
sb
"Shinichi" wrote in message
...
Hi All!

I need to find out if certain names exist in Worksheets
("Data").Range("A1:A300") in my application.
It should give boolean answer True or False.

So I would like to use "Find method" but I could not find
much answer in help file or MSDN library.

Can anyone tell me how to use find method please?

Thanks in advance,
Shinichi



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Find method example

Hi Steve,

Thanks for the help.
Yes, it works for my application.

Shinichi
-----Original Message-----
Shinichi,

I like to use the CountIf function. (It has few if any

errors)
Dim nm As String, x As Integer
nm = "z"
x = WorksheetFunction.CountIf(Sheets("sheet2").Range

("A1:A300"), nm)
If x = 0 Then
MsgBox (nm & " not found")
Else
MsgBox (x & " occurance(s) of " & nm & " found")
End If

You can use a For .... Next loop to cycle through a list

of names.
Or you can use an Input box for the user to enter a name

to search for.
Amend the code to return True or False.

You could build this into a Function instead of a Sub.
--
sb
"Shinichi" wrote in message
...
Hi All!

I need to find out if certain names exist in Worksheets
("Data").Range("A1:A300") in my application.
It should give boolean answer True or False.

So I would like to use "Find method" but I could not

find
much answer in help file or MSDN library.

Can anyone tell me how to use find method please?

Thanks in advance,
Shinichi



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Find method example

Shinichi,

Great! There are many ways to get there, but this one appeals to me since
it doesn't have error issues to work around.

--
sb
"Shinichi" wrote in message
...
Hi Steve,

Thanks for the help.
Yes, it works for my application.

Shinichi
-----Original Message-----
Shinichi,

I like to use the CountIf function. (It has few if any

errors)
Dim nm As String, x As Integer
nm = "z"
x = WorksheetFunction.CountIf(Sheets("sheet2").Range

("A1:A300"), nm)
If x = 0 Then
MsgBox (nm & " not found")
Else
MsgBox (x & " occurance(s) of " & nm & " found")
End If

You can use a For .... Next loop to cycle through a list

of names.
Or you can use an Input box for the user to enter a name

to search for.
Amend the code to return True or False.

You could build this into a Function instead of a Sub.
--
sb
"Shinichi" wrote in message
...
Hi All!

I need to find out if certain names exist in Worksheets
("Data").Range("A1:A300") in my application.
It should give boolean answer True or False.

So I would like to use "Find method" but I could not

find
much answer in help file or MSDN library.

Can anyone tell me how to use find method please?

Thanks in advance,
Shinichi



.



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
Set range with Find method jlclyde Excel Discussion (Misc queries) 1 December 3rd 08 05:44 PM
The find method Stuart[_6_] Excel Programming 0 August 5th 03 03:14 PM
Help with the Find method Mike NG Excel Programming 3 August 4th 03 07:15 PM
The Find Method Dick Kusleika Excel Programming 3 July 16th 03 07:59 PM
The Find Method Brad[_7_] Excel Programming 0 July 16th 03 03:23 PM


All times are GMT +1. The time now is 10:07 AM.

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"