Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default My program read the wrong msgbox

My code in the if case that state that "myCDR.Value = CDLL" do not give me
the msgbox carrectly. When I run my code and myCDR.Value = 0.44=CDLL the
msgbox box that gave me is that is state that "myCDR.Value < CDLL" and I do
not know why this occur. Suggestions will be appreciated. My code is:

------------------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)

Dim CDR As Range
Dim myCDR As Range
Dim CDLL As Variant
Dim CDUL As Variant

Set CDR = ThisWorkbook.Sheets("PERIOD 1").Range("E66")

Set CDLL = ThisWorkbook.Sheets("LIMITS").Range("A3")
Set CDUL = ThisWorkbook.Sheets("LIMITS").Range("B3")

For Each myCDR In CDR
If IsEmpty(myCDR.Value) Or Trim(myCDR.Value) = "" Then
myCDR.Interior.ColorIndex = 15
Else
If myCDR.Value CDLL And myCDR.Value < CDUL Then
myCDR.Interior.ColorIndex = 15
Else
If myCDR.Value < CDLL Then
MsgBox "LOT EXCEED THE COSMETIC DEFECT LOWER LIMIT (" &
CDLL & ")!"
myCDR.Interior.ColorIndex = 3
Else
If myCDR.Value CDUL Then
MsgBox "LOT EXCEED THE COSMETIC DEFECT UPPER LIMIT ("
& CDUL & ")!"
myCDR.Interior.ColorIndex = 3
Else
If myCDR.Value = CDLL Then
MsgBox "LOT REACH THE COSMETIC DEFECT LOWER LIMIT
(" & CDLL & ")!"
myCDR.Interior.ColorIndex = 3
Else
If myCDR.Value = CDUL Then
MsgBox "LOT REACH THE COSMETIC DEFECT UPPER
LIMIT (" & CDUL & ")!"
myCDR.Interior.ColorIndex = 3
End If
End If
End If
End If
End If
End If
Next
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default My program read the wrong msgbox

It seems to be all right when I tested it. Are you sure that both values are
EXACTLY 0.44? Try manually entering BOTH values and test again. I suspect
that one of them is not quite .44, perhaps due to a calculation or rounding?
--
p45cal


"anamarie30" wrote:

My code in the if case that state that "myCDR.Value = CDLL" do not give me
the msgbox carrectly. When I run my code and myCDR.Value = 0.44=CDLL the
msgbox box that gave me is that is state that "myCDR.Value < CDLL" and I do
not know why this occur. Suggestions will be appreciated. My code is:

------------------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)

Dim CDR As Range
Dim myCDR As Range
Dim CDLL As Variant
Dim CDUL As Variant

Set CDR = ThisWorkbook.Sheets("PERIOD 1").Range("E66")

Set CDLL = ThisWorkbook.Sheets("LIMITS").Range("A3")
Set CDUL = ThisWorkbook.Sheets("LIMITS").Range("B3")

For Each myCDR In CDR
If IsEmpty(myCDR.Value) Or Trim(myCDR.Value) = "" Then
myCDR.Interior.ColorIndex = 15
Else
If myCDR.Value CDLL And myCDR.Value < CDUL Then
myCDR.Interior.ColorIndex = 15
Else
If myCDR.Value < CDLL Then
MsgBox "LOT EXCEED THE COSMETIC DEFECT LOWER LIMIT (" &
CDLL & ")!"
myCDR.Interior.ColorIndex = 3
Else
If myCDR.Value CDUL Then
MsgBox "LOT EXCEED THE COSMETIC DEFECT UPPER LIMIT ("
& CDUL & ")!"
myCDR.Interior.ColorIndex = 3
Else
If myCDR.Value = CDLL Then
MsgBox "LOT REACH THE COSMETIC DEFECT LOWER LIMIT
(" & CDLL & ")!"
myCDR.Interior.ColorIndex = 3
Else
If myCDR.Value = CDUL Then
MsgBox "LOT REACH THE COSMETIC DEFECT UPPER
LIMIT (" & CDUL & ")!"
myCDR.Interior.ColorIndex = 3
End If
End If
End If
End If
End If
End If
Next
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default My program read the wrong msgbox

I test this code by enter manually the values and for that reason is EXACTLY
0.44

"p45cal" wrote:

It seems to be all right when I tested it. Are you sure that both values are
EXACTLY 0.44? Try manually entering BOTH values and test again. I suspect
that one of them is not quite .44, perhaps due to a calculation or rounding?
--
p45cal


"anamarie30" wrote:

My code in the if case that state that "myCDR.Value = CDLL" do not give me
the msgbox carrectly. When I run my code and myCDR.Value = 0.44=CDLL the
msgbox box that gave me is that is state that "myCDR.Value < CDLL" and I do
not know why this occur. Suggestions will be appreciated. My code is:

------------------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)

Dim CDR As Range
Dim myCDR As Range
Dim CDLL As Variant
Dim CDUL As Variant

Set CDR = ThisWorkbook.Sheets("PERIOD 1").Range("E66")

Set CDLL = ThisWorkbook.Sheets("LIMITS").Range("A3")
Set CDUL = ThisWorkbook.Sheets("LIMITS").Range("B3")

For Each myCDR In CDR
If IsEmpty(myCDR.Value) Or Trim(myCDR.Value) = "" Then
myCDR.Interior.ColorIndex = 15
Else
If myCDR.Value CDLL And myCDR.Value < CDUL Then
myCDR.Interior.ColorIndex = 15
Else
If myCDR.Value < CDLL Then
MsgBox "LOT EXCEED THE COSMETIC DEFECT LOWER LIMIT (" &
CDLL & ")!"
myCDR.Interior.ColorIndex = 3
Else
If myCDR.Value CDUL Then
MsgBox "LOT EXCEED THE COSMETIC DEFECT UPPER LIMIT ("
& CDUL & ")!"
myCDR.Interior.ColorIndex = 3
Else
If myCDR.Value = CDLL Then
MsgBox "LOT REACH THE COSMETIC DEFECT LOWER LIMIT
(" & CDLL & ")!"
myCDR.Interior.ColorIndex = 3
Else
If myCDR.Value = CDUL Then
MsgBox "LOT REACH THE COSMETIC DEFECT UPPER
LIMIT (" & CDUL & ")!"
myCDR.Interior.ColorIndex = 3
End If
End If
End If
End If
End If
End If
Next
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default My program read the wrong msgbox

One way I got to getting the same message was if in the cell containing CDLL
was this:
O.44
or
o.44
as opposed to 0.44

Another stab in the dark: Check whether all the three cells are formatted in
the same way.

p45cal
--
p45cal


"anamarie30" wrote:

I test this code by enter manually the values and for that reason is EXACTLY
0.44

"p45cal" wrote:

It seems to be all right when I tested it. Are you sure that both values are
EXACTLY 0.44? Try manually entering BOTH values and test again. I suspect
that one of them is not quite .44, perhaps due to a calculation or rounding?
--
p45cal


"anamarie30" wrote:

My code in the if case that state that "myCDR.Value = CDLL" do not give me
the msgbox carrectly. When I run my code and myCDR.Value = 0.44=CDLL the
msgbox box that gave me is that is state that "myCDR.Value < CDLL" and I do
not know why this occur. Suggestions will be appreciated. My code is:

------------------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)

Dim CDR As Range
Dim myCDR As Range
Dim CDLL As Variant
Dim CDUL As Variant

Set CDR = ThisWorkbook.Sheets("PERIOD 1").Range("E66")

Set CDLL = ThisWorkbook.Sheets("LIMITS").Range("A3")
Set CDUL = ThisWorkbook.Sheets("LIMITS").Range("B3")

For Each myCDR In CDR
If IsEmpty(myCDR.Value) Or Trim(myCDR.Value) = "" Then
myCDR.Interior.ColorIndex = 15
Else
If myCDR.Value CDLL And myCDR.Value < CDUL Then
myCDR.Interior.ColorIndex = 15
Else
If myCDR.Value < CDLL Then
MsgBox "LOT EXCEED THE COSMETIC DEFECT LOWER LIMIT (" &
CDLL & ")!"
myCDR.Interior.ColorIndex = 3
Else
If myCDR.Value CDUL Then
MsgBox "LOT EXCEED THE COSMETIC DEFECT UPPER LIMIT ("
& CDUL & ")!"
myCDR.Interior.ColorIndex = 3
Else
If myCDR.Value = CDLL Then
MsgBox "LOT REACH THE COSMETIC DEFECT LOWER LIMIT
(" & CDLL & ")!"
myCDR.Interior.ColorIndex = 3
Else
If myCDR.Value = CDUL Then
MsgBox "LOT REACH THE COSMETIC DEFECT UPPER
LIMIT (" & CDUL & ")!"
myCDR.Interior.ColorIndex = 3
End If
End If
End If
End If
End If
End If
Next
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
My 3rd Msgbox is popping up in wrong position JMay Excel Programming 4 April 23rd 07 07:56 PM
MsgBox To Read A Value of a cell Rob Excel Programming 2 September 7th 05 01:27 PM
Msgbox saying "Unable to read file" lashio Excel Discussion (Misc queries) 3 May 30th 05 07:59 PM
MsgBox execution sends program into design mode Jenn Excel Programming 2 April 14th 04 10:21 PM
Wrong text in msgbox Ed[_9_] Excel Programming 0 August 11th 03 03:21 PM


All times are GMT +1. The time now is 12:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"