Compare cells

  • Thread starter Thread starter mtpsuresh
  • Start date Start date
M

mtpsuresh

Hi,

Can anyone help me out pls.

I am trying to compare two values

if application.worksheetfunction.sum(Range("A1:A2") <>Range("A3").value
then
msgbox "NotEqual"
end if

For Eg:
A1= 676821.92
A2=40936.43
A3=717758.35
it says it is not equal. But if i add VBA.VAL on both side of the
expressions, it doesnt display any message. I really dont get this.
 
Sub equal()
If Range("a1").Value + Range("a2").Value <> Range("A3").Value Then
MsgBox "Not Equal"
Else
MsgBox "Equal"
End If
End Sub


Vaya con Dios,
Chuck, CABGx3
 
Thanks Vaya con Dios.

But still it thows the same message. But if i add trim() on both sides
it doesnt display the message.

Thanks for your response.
 

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