Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Searching for a string and then performing an action if present


I have a pivot table that I am copying and pasting into a new workshee
so I can insert some columns etc.

I need to 'search' row 4 for the existence of the word "Documentation"
If I find it then insert an entire column tot he right of it.

If documentation does not exist then do nothing.

can anyone suggest some code that I could use for this?
thanks,
Mat

--
matp
-----------------------------------------------------------------------
matpj's Profile: http://www.excelforum.com/member.php...fo&userid=2107
View this thread: http://www.excelforum.com/showthread.php?threadid=48756

  #2   Report Post  
Posted to microsoft.public.excel.programming
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

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
Performing Action on a Range of Rows JohnB[_2_] Excel Discussion (Misc queries) 1 July 20th 07 01:48 AM
Performing Action on a Range of Rows JohnB[_2_] Excel Discussion (Misc queries) 2 July 19th 07 06:22 PM
searching for specific criteria and then doing an action based on Bill Excel Discussion (Misc queries) 1 July 20th 05 03:55 AM
Test for char in string & separating if present Ken Loomis Excel Programming 5 October 7th 04 06:38 PM
searching a string with a partial string dcstech Excel Programming 1 April 5th 04 10:57 PM


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