View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
antoka05[_2_] antoka05[_2_] is offline
external usenet poster
 
Posts: 1
Default Searching for a string and then performing an action if present


you can do so:
insert a module in your workbook, then put this function in the module

Function searchMyString(celle As Range, testo As String)
searchMyString = "NO"
For Each cl In celle.Cells
If InStr(cl, testo) 0 Then
searchMyString = "OK"
Exit For
End If
Next

End Function

and then, in your worksheet, for example in cell A1, you can use this
formula
=searchMyString(A4:Z4;"Documentation")

and in cell A1 will be displayed 'OK' if the string 'documentation' is
present in cells from A4 to Z4, else in A1 will be displyed 'NO'

Of course you can change the range of cells in wich to find text, for
example:

=searchMyString(A4:BA4;"Documentation")


--
antoka05
------------------------------------------------------------------------
antoka05's Profile: http://www.excelforum.com/member.php...o&userid=29024
View this thread: http://www.excelforum.com/showthread...hreadid=487568