Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Performing Action on a Range of Rows | Excel Discussion (Misc queries) | |||
Performing Action on a Range of Rows | Excel Discussion (Misc queries) | |||
searching for specific criteria and then doing an action based on | Excel Discussion (Misc queries) | |||
Test for char in string & separating if present | Excel Programming | |||
searching a string with a partial string | Excel Programming |