Run-time error 6: Overflow on a Mac but not on Windows

ResearchGuyDerrick

New Member
Joined
Apr 11, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I've written a macro that begins by asking the user a yes/no question (see below). I have no problem running it on my Windows machine, but my boss is on a Mac and receives a Run-time error 6: Overflow error message. When he debugs, it points him to the If AnswerYes = vbYes Then line. The error occurs whether he selects Yes or No in the dialog box. Is there a fix to this issue? We tried installing available Excel software updates but that did not fix it. Thanks in advance!

VBA Code:
Dim AnswerYes As String
Dim AnswerNo As String

 AnswerYes = MsgBox("Do you want to net some values into an All Other grouping?", vbQuestion + vbYesNo, "User Repsonse")

 If AnswerYes = vbYes Then
   Dim OtherThreshold As Single
   OtherThreshold = InputBox("What's the maximum loyalty you want to include in the All Other grouping? Enter number as a decimal.", "Maximum Loyalty", 0.35)
 End If
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi
welcome to forum

I know nothing about Mac but see if this update to your code resolves the issue

VBA Code:
    Dim Response            As VbMsgBoxResult
    Dim OtherThreshold      As Variant
   
    Response = MsgBox("Do you want To net some values into an All Other grouping?", vbQuestion + vbYesNo, "User Repsonse")
   
    If Response = vbYes Then
       
        Do
            OtherThreshold = InputBox("What's the maximum loyalty you want to include in the All Other grouping? Enter number as a decimal.", "Maximum Loyalty", 0.35)
            'cancel pressed
            If StrPtr(OtherThreshold) = 0 Then Exit Sub
        Loop Until IsNumeric(OtherThreshold)
       
        OtherThreshold = CSng(OtherThreshold)
       
        'rest of code for yes
       
        Else
       
        'code for no
       
    End If

If not, perhaps another here can offer further guidance

Dave
 
Upvote 0

Forum statistics

Threads
1,214,543
Messages
6,120,123
Members
448,947
Latest member
test111

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top