removing cells with certain words in it

  • Thread starter Thread starter Matthew Kramer
  • Start date Start date
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
 
#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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top