Excel VB macro works in Normal mode but not in Step Mode

Hi,


I am at my wit's end. I have (what is now) a very small Excel spreadsheet and VB macro that works when I run it in Normal mode but generates an overflow error when I run it in Step mode. [See the Addendum below for specific details.]


The error is with my MacBook pro. The macro runs in Normal and Step mode on another MacBook pro and on a Windows PC.


In an attempt to resolve the problem I have upgraded from Mojave to macOS Catalina Version 10.15.3 and to Excel version 16.34). I did have problems upgrading my software: attempts to upgrade my operating system and Excel would fail. With help from Apple I have solved that problem.


But I am still left with this glitch.


I am hoping someone might be able to give me a suggestion or two.


Thank you for your help.


David


ADDEMDUM:

My spreadsheet has two ranges, value and valueItems. Each range has three items, each item being a whole number between 0 and 50.


The macro code is:


Public value As Range

Public valueItems As Range

Public variable() As Single


Sub FilterAnalysis()

     Set value = Range("value")

    Set valueItems = Range("valueItems")


     For i = 1 To 3        

ReDim variable(valueItems(i))

               For j = 1 To valueItems(i)

                    variable(j) = value(i)

               Next j 'Macro fails here with overflow error in Step mode. Works OK in Normal mode

    Next i


    msg = "Macro completed successfully"

    Title = "SUCCESS!"

    response = MsgBox(msg, , Title)

    Sheets("test").Select

    Range("A1").Select        


End Sub

MacBook Pro 13", macOS 10.14

Posted on Feb 29, 2020 8:58 PM

Reply

Similar questions

2 replies

Mar 1, 2020 6:53 PM in response to turingtest2

Thanks for taking the time to reply, tt2. I made the changes you suggested (which is certainly useful for me in the future) but I'm afraid it does not fix my problem.


I think there is some small glitch in my software given the macro works in Normal mode on my PC and works in Normal and Step mode on another Mac and on a Windows PC.


I am going to reformat the hard disk and see if that fixes things.


Regards, David

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Excel VB macro works in Normal mode but not in Step Mode

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.