danbrawl93
New Member
- Joined
- Dec 15, 2016
- Messages
- 17
Hey guys,
I have an issue transferring this code from Windows VBA (where it works) to Mac. Both are Excel 2016.
So, on Windows "x" = Range("F3").value and so the message is not displayed. But on Mac, "x" <> Range("F3").value and the message is displayed. However, the following code does work on Mac and the message is not displayed...
Please can somebody explain the issue and help! I can only assume it has something to do with declaring "x" as long. Thanks x
I have an issue transferring this code from Windows VBA (where it works) to Mac. Both are Excel 2016.
Code:
[B]Dim x As Long
[/B][B]x = [/B][I]Worksheetfunction.Sum(Range(Cells(2,3),Cells(y,6)))[/I][B][B][I][I]
[B]If x <> Range("F3").value Then
[/B][/I][/I][/B][/B][I]MsgBox "Hello"[/I][B][B][I][I][B][I]
[B]End If[/B][/I][/B][/I][/I][/B][/B]
So, on Windows "x" = Range("F3").value and so the message is not displayed. But on Mac, "x" <> Range("F3").value and the message is displayed. However, the following code does work on Mac and the message is not displayed...
Code:
(Do not declare the dimension of x)[B]
x = [/B][I]Worksheetfunction.Sum(Range(Cells(2,3),Cells(y,6)))[/I][B][B][I][I]
[B]If x <> Range("F3").value Then
[/B][/I][/I][/B][/B][I]MsgBox "Hello"[/I][B][B][I][I][B][I]
[B]End If
[/B][/I][/B][/I][/I][/B][/B]
OR...
[B][I]If [/I][/B][I]Worksheetfunction.Sum(Range(Cells(2,3),Cells(y,6)))[/I][B][I] <> Range("F3").value Then
[/I][/B][I]MsgBox "Hello"
[/I][B][B][B][B][I]End If[/I][/B][/B][/B][/B]
Please can somebody explain the issue and help! I can only assume it has something to do with declaring "x" as long. Thanks x