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: 54
Default Find sub not finding

Hey guys. I have a bit of code that's supposed to match an inputted number
and see if it exists anywhere else in the workbook (except on "Sheet1"). It
doesn't work. Here's the code:

Sub FindPolicy()

Dim ws As Worksheet

policy = Application.InputBox(prompt:="Enter policy number to find", _
Title:="FIND POLICY", Type:=1)

If policy = "False" Then Exit Sub

For Each ws In ActiveWorkbook.Worksheets
If ws.Name < "Sheet1" Then
On Error Resume Next

Set pFind = ws.Cells.Find(What:=policy, after:=ws.Range("A1"), _
LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _
searchdirection:=xlNext, MatchCase:=False)

On Error GoTo 0

If pFind Is Nothing Then
lReply = MsgBox("Policy cannot be found. Try Again?", vbYesNo)
If lReply = vbYes Then
Run "FindPolicy"
Else
End
End If
Else
pFind.Select
End If
End If
Next

End Sub
 
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 not finding value Emily[_2_] Excel Programming 2 July 20th 09 02:00 AM
Find not finding programatically J Streger Excel Programming 1 February 10th 09 07:05 PM
.find not finding corect value treasuresflemar Excel Programming 1 December 11th 07 09:19 PM
Finding row number with .find() treasuresflemar Excel Programming 2 December 10th 07 11:37 PM
Find/Replace not Finding Sjones Excel Discussion (Misc queries) 1 June 21st 07 07:31 PM


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