Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA - "Call" cannot find the Sub or Function

Tags:

excel

vba

I created the following MACRO:

    Sub X()
        Call Y
        Range("A1:M31").Calculate
    End Sub

Y is defined as Public in another module:

    Public Sub Y()
        Cells(13, 13) = A()
        Cells(14, 13) = B()
    End Sub

Y, when invoked (via button or after some events) works perfectly and ivokes A and B, which are other Macros defined in the same module as Y. However, when I try to invoke it from the other module where X is, I get the compilation error: "Sub or Function not defined".

Where is the problem?

like image 902
Manu Avatar asked Feb 19 '26 16:02

Manu


1 Answers

Moved the code to a separate module and it worked.

like image 59
Manu Avatar answered Feb 22 '26 07:02

Manu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!