LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem with find function in VBA

Hello,

I would like to use the function find in my code. The function work
correctly for all numbers but not for 1 value. The value exist, I
don't understand?

Function cherche(feuille As Object, txt As String, zone As String, p
As Boolean) As Long
' function which find in worksheet 'feuille' the value
' 'txt' in area 'zone'
' p = true = function return the row number
' p = false = function return the column number
' If value is not found, the function return 0
' -------------------------------------------------------
Dim z As String

feuille.Activate

z = Left(zone, InStr(1, zone, ":") - 1)
If feuille.Range(z) = txt Then
feuille.Range(z).Select
If p Then
cherche = feuille.Range(z).Row()
Else
cherche = feuille.Range(z).Column()
End If
Else
With feuille.Range(zone)
Set c = .Find(txt, LookIn:=xlValues, lookAt:=xlPart)
If Not c Is Nothing Then
If p Then
cherche = c.Row()
Else
cherche = c.Column()
End If
Else
cherche = 0
End If
End With
End If
End Function

 
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
Match Function Problem - Won't Find Certain Numbers PE Excel Discussion (Misc queries) 2 May 9th 05 03:53 PM
Problem with Find function in VBA Romuald[_3_] Excel Programming 0 December 16th 04 09:57 AM
Excel VBA Problem- Using Find Function anandmr[_2_] Excel Programming 5 July 20th 04 10:12 PM
Problem in VBA with function FIND(... Decaplan Excel Programming 1 May 21st 04 03:00 AM
Problem with Find function Snedker Excel Programming 1 December 17th 03 10:37 PM


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