View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
cmdecker2 cmdecker2 is offline
external usenet poster
 
Posts: 9
Default Need Help With Code Quick!!

The clue is to decide if you want to do two searches or one and if that ends
up blank then another. That determins to in clude in end if statement or
not.
Carl


"Tom Ogilvy" wrote in message
...
Guess you didn't write any of this code, because it is pretty much is set

up
to act the way you describe.


Dim oFound as Range
Set ofound = Columns(1).Find(WHAT:="EXT", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True)
If Not ofound Is Nothing Then
' this is only run if EXT is found
ofound.Activate
If Trim(ofound) = "EXT" Then
ActiveCell.Offset(rowOffset:=0, columnOffset:=4).Activate
Selection.Copy
Windows("BOOK1.XLS").Activate
Range("D3").Select
ActiveSheet.Paste
Application.goto oFound
End if ' trim(ofound) = "EXT"
End if ' Not ofound is Nothing

the test, IF not ofound is nothing then
only does the above copy and paste if a cell with EXT was found in column

1.
Otherwise it drops down to the End If and if the code after that is

another
search, it would do that.

I indented the code in the If Then; End if block to make that clearer.

--
Regards,
Tom Ogilvy


"alexm999 " wrote in message
...
Works Great thanks!

But...

What if the word EXT is not there? depending on the day, EXT may not
show up. how can i get it to search for EXT and then if not found, move
on to the next search, but if found run the script i listed above..


---
Message posted from http://www.ExcelForum.com/