View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Sandeman[_2_] Sandeman[_2_] is offline
external usenet poster
 
Posts: 1
Default Macro idendifying keywords


Very cool Tom. Thank you. The If, Then line is not working out and I'm
not sure what's wrong with it. Any ideas?

Tom Ogilvy Wrote:
Sub ProcessWords()
Dim v as Variant, v1 as Variant
Dim rng as Range, cell as Range
Dim i as Long, col as long
v = Array("Italian","BasketBall")
v1 = Array("Italy","BasketBall)
set rng = Range(Cells(1,3),Cells(rows.count,3).End(xlup))
for each cell in rng
col = 4
for i = lbound(v) to ubound(v)
IF INSTR(1,CELL.VALUE,V(I).VBTEXTCOMPARE) THEN
cells(cell.row,col).Value = v1(i)
col = col + 1
end if
Next
Next
End Sub

Modify v to include all the key words and v1 to include the words you
want
placed to the right if a keyword is found

Code is untested and may contain typos, but should suggest a workable
approach

--
Regards,
Tom Ogilvy



"Sandeman" wrote:


Excel gurus...

I have a spreadsheet that in Column C has descriptive data all in

text
form. The data might say something like "Paul is an Italian

basketball
player."

What I need is for a macro to recognize the word "Italian" and place
the word "Italy" in Column E to the right of the data column. Then

I'd
like to have another macro to recognize "basketball" and place
"basketball" in Column F.

However, sometimes there won't be information for Column E, in which
case the data in Column F needs to move over to Column E if E is

blank.


And it needs to run for the entire set of rows.

Is this possible? Many thanks in advance.

Sandeman


--
Sandeman

------------------------------------------------------------------------
Sandeman's Profile:

http://www.excelforum.com/member.php...o&userid=32440
View this thread:

http://www.excelforum.com/showthread...hreadid=522153




--
Sandeman
------------------------------------------------------------------------
Sandeman's Profile: http://www.excelforum.com/member.php...o&userid=32440
View this thread: http://www.excelforum.com/showthread...hreadid=522153