How to convert 32-bit VBA/Excel function so that it works in 64-bit VBA/Excel?

SteradianRK

New Member
Joined
Aug 24, 2022
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hello,

I was using 32-bit Excel 2013 and had a workbook with a number of bespoke functions, some simple, some not so simple. However, after upgrading to 64-bit Office 365 all of my bespoke functions do not seem to be working.

Here is example code to work out the inverse of the tangent function (atan, or tan^-1)with the outputs in degrees, not radians. (Of course I know this can be done writing =DEGREES(ATAN(#)) instead, that is not really the point though... Creating a function called ATAND improves readability and is convenient, etc...)

VBA Code:
Function ATAND(Val) As Double
'*************************************************************************
' DESCRIPTION
'   This function performs trig but with outputs in degrees, not radians
'*************************************************************************
    Dim PI As Double
    PI = 4 * Atn(1)
    ATAND = 180 / PI * Atn(Val)
End Function

Please could you advise on how this function should be modified to work in 64-bit VBA? I note that all "Declare" statements should be preceded by PrtSafe, but there is no Declare statement above!

Many thanks.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
This function doesn't require conversion as it doesn't make any API calls nor does it rely on any Bit-dependent data types.
 
Upvote 0
OK thank you for your reply. It seems to be working now... no idea what caused the error in the first place!
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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