Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can't Find Value

i'm trying to search in a hidden worksheet that i've created for use
names. below is the code but it doesn't work. can someone please hel
me out? btw, i'm really curious as to where i can find more informatio
about that find method and for that matter, all the method's that ar
used in excel. the excel help file is very lacking in information. i
doesn't list nearly as many parameters for the find function as i'v
seen in examples here in the forums.

Public Function VerifyPW(Name As String) As Boolean
Dim Found As WorksheetFunction
With Worksheets(5).Range("A1:A30")
Set Found = .Find(What:=Name, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True)
End With

VerifyPW = Not (Found Is Nothing)
VerifyPW = True
End Functio

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Can't Find Value

Hi

You've declared
Dim Found As WorksheetFunction
but your code should return a range:
Dim Found As Range

(If you used Option Explicit on top of your modules then you'd receive a
helpful "Type mismatch" error.)

HTH. Best wishes Harald

"majikman " skrev i melding
...
i'm trying to search in a hidden worksheet that i've created for user
names. below is the code but it doesn't work. can someone please help
me out? btw, i'm really curious as to where i can find more information
about that find method and for that matter, all the method's that are
used in excel. the excel help file is very lacking in information. it
doesn't list nearly as many parameters for the find function as i've
seen in examples here in the forums.

Public Function VerifyPW(Name As String) As Boolean
Dim Found As WorksheetFunction
With Worksheets(5).Range("A1:A30")
Set Found = .Find(What:=Name, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True)
End With

VerifyPW = Not (Found Is Nothing)
VerifyPW = True
End Function


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can't Find Value

thanks for the help harald. However, it still doesn't work. I set
watch on Found and it keeps showing that its Nothing. btw, i did us
option explicit at the very top of my module so i'm not sure why i
didn't return me a type mismatch that time because it has in the past

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Can't Find Value

Found will = Nothing if no match is made. Do a test with a known value firs

----- majikman wrote: ----

thanks for the help harald. However, it still doesn't work. I set
watch on Found and it keeps showing that its Nothing. btw, i did us
option explicit at the very top of my module so i'm not sure why i
didn't return me a type mismatch that time because it has in the past


--
Message posted from http://www.ExcelForum.com


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can't Find Value

i am doing that. thats why i'm saying its not working because i am
testing with a known value and it continuously returns nothing


---
Message posted from http://www.ExcelForum.com/



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can't Find Value

ok, so i've updated my code and now it looks like this

Public Function VerifyPW(Name As String) As Boolean
Dim rng As Range
Dim Found As Range
Set rng = Worksheets("Users").Columns("A:A")
With rng
Set Found = .Find(What:="dan", MatchCase:=True)
End With

VerifyPW = Not (Found Is Nothing)
VerifyPW = True
End Function

if i explicitly state What as "dan", it will find it properly. However
if i try to use my Name variable, it won't work anymore. when I use m
name variable, i use What:=Name. Do i need to put name inbetween som
kind of characters, like quotes, to let it know that its a variable

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Can't Find Value

Public Function VerifyPW(Name As String) As Boolean
Dim rng As Range
Dim Found As Range



Set rng = Worksheets("Users").Columns("A:A")

Set Found = rng.Find(What:="dan", MatchCase:=True)

VerifyPW = Not (Found Is Nothing)

End Function




-----Original Message-----
ok, so i've updated my code and now it looks like this

Public Function VerifyPW(Name As String) As Boolean
Dim rng As Range
Dim Found As Range
Set rng = Worksheets("Users").Columns("A:A")
With rng
Set Found = .Find(What:="dan", MatchCase:=True)
End With

VerifyPW = Not (Found Is Nothing)
VerifyPW = True
End Function

if i explicitly state What as "dan", it will find it

properly. However,
if i try to use my Name variable, it won't work anymore.

when I use my
name variable, i use What:=Name. Do i need to put name

inbetween some
kind of characters, like quotes, to let it know that its

a variable?


---
Message posted from http://www.ExcelForum.com/

.

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
Find First Non blank cell than find column header and return that value Silver Rose Excel Worksheet Functions 10 April 30th 07 05:56 PM
where to put results of find operation in find and replace functio DEP Excel Worksheet Functions 5 November 15th 06 07:52 PM
Despite data existing in Excel 2002 spreadsheet Find doesn't find AnnieB Excel Discussion (Misc queries) 1 June 16th 06 02:15 AM
'find' somtimes can't find numbers. I folowd the 'help' instructi. Yaron Excel Worksheet Functions 2 November 30th 05 05:46 PM
backwards find function to find character in a string of text Ashleigh K. Excel Programming 1 January 14th 04 04:36 PM


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