worksheet subroutine causes Compile error: Not found when on User

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Attempts to execute a subroutine (or function) defined on a worksheet module
fail with compile error: sub - function not found. The sub works fine when
called from another worksheet. I open the user form nonmodally to allow
worksheet tasks. I have checked the spelling of the subroutine and it is
defined as Public.
Thanks, Jim
 
Preface the call with a reference to the worksheet where the routine is
stored.

Call Sheets("Sheet1").Myprocedure
or
Call Sheet1.Myprocedure
 
Works great. I should have though of that, but am following examples in Jeff
Webb & Seve Saunders new book: Programming Excel with vba & .net from
O'rielly- pgs 802+. Their examples show just the sub or function name (not
qualified by the sheet name). Other than this minor problem, great book. Much
Thanks, Jim
 
You do not have to reference a module, but you do neet to explicitly
reference sheets and ThisWorkbook to use their procedures.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top