• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Runtime 6 error

UserX

New Member
In excel macro the following code is generating a runtime 6 error:

>>> use code - tags <<<
Code:
Sub runerror()
Dim var1 As Single
   var1 = 1
End Sub

If dimensioned as Integer or Long, no error. Also get error if dimensioned as Double. The name of the variable and whether or not include a decimal point after the 1 doesn't matter.
 
Problem is occurring in a larger multi routine macro with a lot of public variables. I had been running it without any problem years ago on earlier Mac OS, tried rerunning now & encountered problem in the 1st subroutine which initializes variables. The run error occurs when try to initialize any variable assigned as Single (or Double). Integers are OK. I trimmed down a copy of the code to decrease storage allocations & reduce the number of variables but still getting problem. I tried inserting that little routine above right at the beginning & get the problem. For some reason the code does not like real numbers.
 
Seems this problem is unique to VBA on Mac OS Catalina. Other users report same problem when declaring Double, I find occurs whether Double or Single. Codes run fine on Windows.
 
Back
Top