Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mesage box - Conditional formating

Status
Not open for further replies.

coltaalex

Technical User
Jul 2, 2010
61
US
Why when i use message box for cell with no conditional formatting , the message box is displayed

but when i use the the message box for conditional formatted cells, the box is not showing up.
 

Maybe because there is something wrong with your code?

If you show your code - somebody can point it out to you.....

Have fun.

---- Andy
 
Sub CodeExist2()
'
' CodeExist2 Macro

Application.Goto Reference:="R11C16:R10000C16"
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=COUNTIF(Code,P11)=0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False

Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=LEN(TRIM(P11))=0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False



Dim N As Long
For N = 1 To 10000
If Cells(N, 16).Interior.ColorIndex = 3 Then
MsgBox "Codes don't Exist "
Exit For
Else

End If
ext N


End Sub
 
I've already answered this in your other thread

colours applied by Conditional formatting are NOT the same as those applied by setting the colour of the cell

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
thank you, how it will for the countif, when i'm using
Dim N As Long, i As Long
i = 0
For N = 1 To 9989
If CountIf(Cells(N, 16).Text) = "" Then
i = i + 1
Exit For
Else
End If
Next N

If i > 0 Then
MsgBox ("fajk")
End If


it gives me the error message :
compile Error:
sub or function not defined
 
Hi Geoff are you still here ?
why countif is not working ?
 
Your COUNTIF isn't working because the syntax isn't correct...

If CountIf(Cells(N, 16).Text) = "" Then

should be something like

If CountIf(cells(N, 16), Cells(N, 16).Text = "") Then

this probably wouldn't exactly work, but do a search in the help for COUNTIF and it'll show you the correct syntax...

Have Fun...

Be Alert, America needs more lerts
 

If CountIf(Cells(N, 16).Text) = "" Then

try this:

If worksheetfunction.CountIf(<sometype of range>, Cells(N, 16).Text = "") Then

COUNTIF syntax

COUNTIF(range,criteria)



Be Alert, America needs more lerts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top