Kim
Kim

Reputation: 163

Sub Not Defined Error: Calling a Macro in Another Sheet

I'm trying to call a sub from another sub and am getting a Sub Not Defined error.

I'm trying to run a macro that hides a row in Sheet4 when a specific cell in Sheet1 changes.

Here is my code for Sheet1:

Public Sub HiddenValidations()
    If [O18]=true then call test
End Sub

Here is my code for Sheet4:

Public Sub test()
    Rows("7").entirerow.hidden=true
End Sub

Thank you for your help!

-Kim

Upvotes: 2

Views: 107

Answers (1)

YowE3K
YowE3K

Reputation: 23984

You need to qualify your macro name:

Public Sub HiddenValidations()
    If [O18]=true Then Sheet4.test
End Sub

(And there is no need for the Call to invoke a macro - as far as I know, it exists only for backward-compatibility reasons.)

Upvotes: 2

Related Questions