LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Foolproof .find

Dave,

Your program seems to have worked exactly as required. I will study it
closely.

Thank you again for your time. It is very much appreciated.

Regards,

Robin

"Dave Peterson" wrote in message
...
I made a small user form (a textbox and a commandbutton) and had this code
behind it:

Option Explicit
Private Sub CommandButton1_Click()
Dim wks As Worksheet
Dim FoundCell As Range

Set wks = Worksheets("Sheet1")
If Me.TextBox1.Value = "" Then
Beep
Exit Sub
End If

With wks
With .Range("A:A")
Set FoundCell = .Cells.Find(what:=Me.TextBox1.Value, _
after:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
Lookat:=xlPart, _
searchorder:=xlByRows, _
searchdirection:=xlNext, _
MatchCase:=False)
End With
End With

If FoundCell Is Nothing Then
MsgBox "Not found"
Else
MsgBox "Found it: " & FoundCell.Address
End If

End Sub

It worked fine when I typed 48-00-3011 into the textbox (or even
'48-00-3011).




"Robin S." wrote:

LenB wrote:
Expanding on what Dave says, I would also try copy/paste from one of
the
part number cells into the text box and see if that fails. That points
you towards whether it is a difference in the text or a param in the
.find command.

Len


Len and Dave,

The product numbers actually contain an apostrophy before the number,
ie.:

'48-00-3011

But I used =RIGHT(A2,10) to remove it. Using xlPart doesn't seem to
help either. It would probably have unfortunate results anyway as some
of our lists have several thousand product numbers which can be of any
length and one part number may be a complete part of another. I.e.
123456 and 1234 could be two part numbers in the same list. I don't
have access to the file right now, but I will try xlPart again just to
make sure.

I can do Edit/Find to find part numbers, and it works. I also did
copy/paste into the form's textbox and that doesn't work.

Indeed, even when I manually type in a test product number into the
price list (including a test description and test price) .find is
unable to find the number.

In my limited understanding of Excel, I believe selecting a column and
formatting it doesn't affect the way things like .find work. I wish the
solution was so simple.

I appriciate the time everyone's taking with my silly problem.

Regards,

Robin


--

Dave Peterson



 
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
Despite data existing in Excel 2002 spreadsheet Find doesn't find AnnieB Excel Discussion (Misc queries) 1 June 16th 06 02:15 AM
find and delete duplicate entries in two columns or find and prin. campare 2 columns of numbers-find unique Excel Programming 1 November 24th 04 04:09 PM
find and delete text, find a 10-digit number and put it in a textbox Paul Excel Programming 3 November 16th 04 04:21 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 07:20 PM.

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"