ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help with Msgbox (https://www.excelbanter.com/excel-programming/302006-help-msgbox.html)

helmekki[_12_]

help with Msgbox
 
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

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

help with Msgbox
 
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.

--
Regards,
Tom Ogilvy

"helmekki " wrote in message
...
i did conditional formatting that if a cell value is <=2 change the
color to purpel,
then after that did writ a code that makes a Msgbox appears as a
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
hesham


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 04:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com