I am trying to call a Sub I defined inside a Sheet, from a Module.
The code I use in my Module (which happens to be inside a Sub):
CallByName Worksheets("Sheet_name"), "Sub_name", vbMethod
But Excel does not execute the Sub. The Module and Sheet are inside the same workbook.
You need to set your function to Public
as shown below
Sheet1:
Public Sub test()
MsgBox "Got here!"
End Sub
Module:
Sub callTest()
With Sheet1
Call .test
End With
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With