removing cells with certain words in it

M

Matthew Kramer

What would be the code for the following two things:

#1:
- check the cell in column 4
- if it contains the word "calculated" anywhere in the cell either as a
stand alone word or as part of a larger word - do nothing
- otherwise, go to procedure "proceed".

#2:
- if the contents of the cell meet the following two conditions:
a) contains the digits 1 and 4
b) does not contain the word "calculated" anywhere in the cell either as
a stand alone word or as part of a larger word
then go on to procedure "proceed".
If it doesn't meet the above conditions, do nothing.

Many thanks in advance.

Matthew Kramer



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
T

Tom Ogilvy

#1
cell = Cells(ActiveCell.Row,4)
if Instr(1,cell.Text,"calculated",vbTextCompare) = 0 Then
proceed
End if

#2
cell = Cells(ActiveCell.Row,4)
If Instr(1,cell.Text,"1",vbTextCompare) > 0 and _
Instr(1,cell.Text,"4",vbTextCompare) > 0) and _
Instr(1,cell.Text,"calculated",vbTextCompare) = 0 then
proceed
End if
 
Top