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: 12
Default Find and Find Next problem

Hello,

I'm using the following code to search for data within a column. It's
working fine, but it only finds the first occurrence of the search term, when
often there may be 4 or 5 in the whole column. Can anyone tell me the extra
bit of code I need to enable me to keep searching until the end of the column
(eg a column of data from A1:A100)?

Sub SearchPT()
Dim str As String
Dim fCell As Range
Dim R As Range
Set R = Worksheets("Sheet1").Range("A:A")
str = InputBox("Enter Product")
Set fCell = R.Find(What:=str & "*", _
After:=R.Cells(R.Cells.Count), _
LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
If fCell Is Nothing Then
MsgBox "Can't find product"
Exit Sub
End If
fCell.Activate
End Sub

Thanks for any help!

Richard.
 
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 Next problem Terry K Excel Programming 8 November 21st 05 05:17 PM
problem with FIND cjsmith22 Excel Worksheet Functions 3 November 17th 05 11:03 PM
Find problem alanthecat Excel Programming 7 July 5th 05 01:17 PM
find problem jon Excel Programming 2 May 24th 04 11:27 AM
Problem with FIND LSB Excel Programming 2 January 12th 04 04:16 AM


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