#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default find

I have the following code:

With rng
Set xcell = .find(what:=drwno, LookIn:=xlValues,
LookAt:=xlWhole, _
SearchOrder:=xlByColumns)
a = xcell.Offset(0, 10).Value
xcell.Offset(0, 10).Select
If a < linkno Then
cnt = 0
Do
cnt = cnt + 1
Set xcell = .FindNext(xcell)
a = xcell.Offset(0, 10).Value
Loop While a < linkno And cnt < drwitemnum + 1
xcell.Select
End If
End With

How do I get the procedure to skip 'find' if there is no 'drwno' in the range?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default find

With rng
Set xcell = .find(what:=drwno, LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByColumns)

if xcell is nothing then
'not found, what happens
exit sub 'maybe???
else
a = xcell.Offset(0, 10).Value
....



ranswert wrote:

I have the following code:

With rng
Set xcell = .find(what:=drwno, LookIn:=xlValues,
LookAt:=xlWhole, _
SearchOrder:=xlByColumns)
a = xcell.Offset(0, 10).Value
xcell.Offset(0, 10).Select
If a < linkno Then
cnt = 0
Do
cnt = cnt + 1
Set xcell = .FindNext(xcell)
a = xcell.Offset(0, 10).Value
Loop While a < linkno And cnt < drwitemnum + 1
xcell.Select
End If
End With

How do I get the procedure to skip 'find' if there is no 'drwno' in the range?
Thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default find

Thanks I'll try that

"Dave Peterson" wrote:

With rng
Set xcell = .find(what:=drwno, LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByColumns)

if xcell is nothing then
'not found, what happens
exit sub 'maybe???
else
a = xcell.Offset(0, 10).Value
....



ranswert wrote:

I have the following code:

With rng
Set xcell = .find(what:=drwno, LookIn:=xlValues,
LookAt:=xlWhole, _
SearchOrder:=xlByColumns)
a = xcell.Offset(0, 10).Value
xcell.Offset(0, 10).Select
If a < linkno Then
cnt = 0
Do
cnt = cnt + 1
Set xcell = .FindNext(xcell)
a = xcell.Offset(0, 10).Value
Loop While a < linkno And cnt < drwitemnum + 1
xcell.Select
End If
End With

How do I get the procedure to skip 'find' if there is no 'drwno' in the range?
Thanks


--

Dave Peterson

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 and Replace - delete the remainder of the text in the cell after my Find [email protected] Excel Programming 4 August 4th 07 03:39 AM
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
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 05:21 PM.

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"