ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   worksheet subroutine causes Compile error: Not found when on User (https://www.excelbanter.com/excel-programming/369867-worksheet-subroutine-causes-compile-error-not-found-when-user.html)

Jim Brownson

worksheet subroutine causes Compile error: Not found when on User
 
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

Jim Thomlinson

worksheet subroutine causes Compile error: Not found when on User
 
Preface the call with a reference to the worksheet where the routine is
stored.

Call Sheets("Sheet1").Myprocedure
or
Call Sheet1.Myprocedure

--
HTH...

Jim Thomlinson


"Jim Brownson" wrote:

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


Jim Brownson

worksheet subroutine causes Compile error: Not found when on U
 
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

"Jim Thomlinson" wrote:

Preface the call with a reference to the worksheet where the routine is
stored.

Call Sheets("Sheet1").Myprocedure
or
Call Sheet1.Myprocedure

--
HTH...

Jim Thomlinson


"Jim Brownson" wrote:

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


Jim Thomlinson

worksheet subroutine causes Compile error: Not found when on U
 
You do not have to reference a module, but you do neet to explicitly
reference sheets and ThisWorkbook to use their procedures.
--
HTH...

Jim Thomlinson


"Jim Brownson" wrote:

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

"Jim Thomlinson" wrote:

Preface the call with a reference to the worksheet where the routine is
stored.

Call Sheets("Sheet1").Myprocedure
or
Call Sheet1.Myprocedure

--
HTH...

Jim Thomlinson


"Jim Brownson" wrote:

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



All times are GMT +1. The time now is 08:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com