#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Foundcell

Hi. In the following code I have an "If" statement if the cell is not found.
How would I rephrase this if statement to execute if the cell was not found?

With Worksheets("Issues Only").Range("b:b")
Set FoundCell = .Cells.Find(What:=pn2, _
After:=.Cells(1), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False, SearchFormat:=False)
End With
If FoundCell Is Nothing Then


rownum = FoundCell.Row
issued = issued + Cells(rownum, 4)
issdoll = issdoll + Cells(rownum, 5)
End If
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Foundcell

change this

If FoundCell Is Nothing Then


to this

If NOT FoundCell Is Nothing Then


"Mike" wrote:

Hi. In the following code I have an "If" statement if the cell is not found.
How would I rephrase this if statement to execute if the cell was not found?

With Worksheets("Issues Only").Range("b:b")
Set FoundCell = .Cells.Find(What:=pn2, _
After:=.Cells(1), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False, SearchFormat:=False)
End With
If FoundCell Is Nothing Then


rownum = FoundCell.Row
issued = issued + Cells(rownum, 4)
issdoll = issdoll + Cells(rownum, 5)
End If

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Foundcell

Thanks for your help, Patrick.

"Patrick Molloy" wrote:

change this

If FoundCell Is Nothing Then


to this

If NOT FoundCell Is Nothing Then


"Mike" wrote:

Hi. In the following code I have an "If" statement if the cell is not found.
How would I rephrase this if statement to execute if the cell was not found?

With Worksheets("Issues Only").Range("b:b")
Set FoundCell = .Cells.Find(What:=pn2, _
After:=.Cells(1), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False, SearchFormat:=False)
End With
If FoundCell Is Nothing Then


rownum = FoundCell.Row
issued = issued + Cells(rownum, 4)
issdoll = issdoll + Cells(rownum, 5)
End If

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



All times are GMT +1. The time now is 05:36 AM.

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"