PDA

View Full Version : Solved: If Statements



khalid79m
09-08-2009, 04:43 AM
Range "Comp1" is column a3 to the lastrow with data.

If Comp1 contains either "No_Error," or ", No_Error" or "N/A," or ", N/A" then clearcontents of that cell.


eg a9 which is within the range Comp1 has the following in it

"C36, No_Error" then this meets the criteria above so a9 should now be blank as the contents would have been cleared.

:dunno

Bob Phillips
09-08-2009, 06:18 AM
For Each cell in Range("Comp1")

If cell.Value Like "*No_Error*" Or cell.Value Like "*N/A*" Then

cell.ClearContents
End If
Next cell

khalid79m
09-08-2009, 06:27 AM
this wont work :) as I need to keep the enteries that have

No_Error
or
N/A

and only clear the ones with

, N/A
N/A,

or

, No_Error
No_Error,

Bob Phillips
09-08-2009, 06:34 AM
You are allowed to try yourself



For Each cell In Range("Comp1")

If cell.Value Like "*No_Error,*" Or cell.Value Like "*, No_Error*" Or _
cell.Value Like "*N/A,*" Or cell.Value Like "*, N/A*" Then

cell.ClearContents
End If
Next cell

khalid79m
09-08-2009, 06:57 AM
sorry, thanks this works fine :)