K Technologies

I get the error "A VBA function was called as a worksheet function"

[Q] I get the error "A VBA function was called as a worksheet function".

[A] This error appears when you call a VBA function as a worksheet function by mistake.

For more information, please refer to the FAQ "Worksheet function does not work".

From version 7.0.10 onwards, in order to prevent Excel from crashing, the caller is checked, and if the caller is a worksheet, this error is displayed only once and the function value NaN (for double type) or 0 (for other types) is returned. NaN is displayed as #NUM! or 2.7E+308 on the worksheet.

The caller check will cause an error not only when the VBA function name is entered directly into the worksheet, but also when a worksheet function is created in VBA and an XLPack VBA function is used in it (indirectly called). 7.0.10 In version 1.0 and later, subroutine versions of some functions are provided as shown below, so if you want to call them indirectly from a worksheet, please use the subroutine versions.

A3. D1num_sub, IsFinite_sub, IsInf_sub, IsNan_sub, IsNormal_sub, Signbit_sub

C1. Factorial_sub

C2. Fma_sub, Hypot_sub, Cbrt_sub

C3. Alaguerre_sub, Alegendre_sub, Chebtd_sub, Chebt_sub, Chebu_sub, Gegenbauerd1_sub, Gegenbauerd_sub, Gegenbauer_sub, Hermite_sub, Jacobid1_sub, Jacobid2_sub, Jacobid_sub, Jacobi_sub, Laguerre_sub, Legendred_sub, Legendre_sub, Sharmonici_sub, Sharmonicr_sub

C4. Cospi_sub, Exp2_sub, Expm1_sub, Log1p_sub, Log2_sub, Powm1_sub, Sinpi_sub, Sqrt1pm1_sub

C5. E1_sub, Ei_sub, En_sub, Li_sub, Spence_sub

C6. Chi_sub, Ci_sub, Shi_sub, Si_sub

C7a. Gamdratio_sub, Gamma1pm1_sub, Gamratio_sub, Gamr_sub, Lngams_sub, Lngam_sub, Poch1_sub, Poch_sub

C7b. Beta_sub, Lnbeta_sub

C7c. Digamma_sub, Polygamma_sub, Trigamma_sub

C7e. Gamic_sub, Gamit_sub, Gami_sub, Gammapd_sub, Gammapia_sub, Gammapi_sub, Gammap_sub, Gammaqia_sub, Gammaqi_sub, Gammaq_sub

C7f. Betaxc_sub, Betax_sub, Ibetacia_sub, Ibetacib_sub, Ibetaci_sub, Ibetac_sub, Ibetad_sub, Ibetaia_sub, Ibetaib_sub, Ibetai_sub, Ibeta_sub

C7g. Zeta_sub

C8. Dawson_sub, Erfci_sub, Erfi_sub, Fresc_sub, Fress_sub

C10a. Besj0_sub, Besj1_sub, Besjnd_sub, Besjnud_sub, Besjnu_sub, Besjn_sub, Besy0_sub, Besy1_sub, Besynd_sub, Besynud_sub, Besynu_sub, Besyn_sub, Sbesjnu_sub, Sbesjn_sub, Sbesynu_sub, Sbesyn_sub

C10b. Besi0_sub, Besi1_sub, Besind_sub, Besinud_sub, Besinu_sub, Besin_sub, Besk0_sub, Besk1_sub, Besknd_sub, Besknud_sub, Besknu_sub, Beskn_sub, Sbesinu_sub, Sbesin_sub, Sbesknu_sub, Sbeskn_sub

C10d. Airyaid_sub, Airyai_sub, Airybid_sub, Airybi_sub

C11. Chu_sub, Hyp0f1_sub, Hyp1f0_sub, Hyp1f1r_sub, Hyp1f1_sub, Hyp2f0_sub, Hyp2f1_sub, Lhyp1f1_sub

C13. Jcd_sub, Jcn_sub, Jcs_sub, Jdc_sub, Jdn_sub, Jds_sub, Jnc_sub, Jnd_sub, Jns_sub, Jsc_sub, Jsd_sub, Jsn_sub, Jtheta1t_sub, Jtheta1_sub, Jtheta2t_sub, Jtheta2_sub, Jtheta3m1t_sub, Jtheta3m1_sub, Jtheta3t_sub, Jtheta3_sub, Jtheta4m1t_sub, Jtheta4m1_sub, Jtheta4t_sub, Jtheta4_sub

C14. Celli1_sub, Celli2_sub, Celli3_sub, Elli1_sub, Elli2_sub, Elli3_sub, Hlambda_sub, Jzeta_sub, Rc_sub, Rd_sub, Rf_sub, Rg_sub, Rj_sub

C19. Dconst_sub

D1a. Dasum_sub, Ddot_sub, Dnrm2_sub

L6a5. Drand48Exp_sub, GenrandExp_sub, RanfArrExp_sub

L6a7. Drand48Gam_sub, GenrandGam_sub, RanfArrGam_sub

L6a14. Drand48Norm_sub, GenrandNorm_sub, RanfArrNorm_sub

L6a21. Genrand64Int63_sub, Genrand64Int64_sub, Genrand64Real1_sub, Genrand64Real2_sub, Genrand64Real3_sub, GenrandInt31_sub, GenrandInt32_sub, GenrandReal1_sub, GenrandReal2_sub, GenrandReal3_sub, GenrandRes53_sub, Drand48_sub, Lrand48_sub, Mrand48_sub, RanArrNext_sub, RanfArrNext_sub

R. D1mach_sub, Dlamch_sub, I1mach_sub, R1mach_sub, Slamch_sub