help with Msgbox

  • Thread starter Thread starter helmekki
  • Start date Start date
H

helmekki

i did conditional formatting that if a cell value is <=2 change th
color to purpel,
then after that did writ a code that makes a Msgbox appears as
wornning followed by another
Msgbox that give the exact addrress of the cell that contain <=2.....

i tried to with this code, but it did not work........
any hints is appreciated.............


Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
'Dim myCheck As Integer

For Each c In Sheet3.Range("E32:E1800").Cells
If c.Interior.ColorIndex <> -4142 Then
If c.Value <= 2 Then
c.Interior.ColorIndex = 3
MsgBox """?C????I ??I ???C? C??I??? ???E ?E? ", vbOKOnly, " Warnning"
MsgBox c.Address
End If
End If
Next
End Sub

yours
hesha
 
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
'Dim myCheck As Integer

For Each c In Sheet3.Range("E32:E1800").Cells

If c.Value <= 2 Then
c.Interior.ColorIndex = 3
MsgBox """?C????I ??I ???C? C??I??? ???E ?E? ", vbOKOnly, " Warnning"
MsgBox c.Address
End If

Next
End Sub

Conditional formatting doesn't change the value of the interior.colorindex
property. Since you are checking the condition of the value being less than
or equal to 2, it should work if you remove the colorindex check.
 

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