Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default Sub or Function not Defined

I'm using Excel 2007. I have a form to input to a spreadsheet. I have 2
routines, 1 to put the information from the form to a sheet , Sub FillSheet
(), another to take information from the sheet and show it in labels on the
form, Sub FillForm (). I have a command button to run the code 'Call
FillSheet' and 'Call FillForm'. This works fine on the form. I want to fill
the form when it opens so I put 'Call FillForm' with the Workbook Open code.
This is where I get the error. How do I difine the 'Sub FillSheet' is on a
different page of code?
Thanks
Doug

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...el.programming
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Sub or Function not Defined

Hi Doug

Use the Userform_Initialize event in the userform code sheet to fill
the userform. This code will fire first time the userform is showed,
and when the userform has been unloaded.

Private Sub UserForm_Initialize()
Call FillForm
End Sub

Hopes this helps.

---
Per

On 7 Maj, 01:45, Doug wrote:
I'm using Excel 2007. *I have a form to input to a spreadsheet. *I have 2
routines, 1 to put the information from the form to a sheet , Sub FillSheet
(), another to take information from the sheet and show it in labels on the
form, Sub FillForm (). *I have a command button to run the code 'Call
FillSheet' and 'Call FillForm'. *This works fine on the form. *I want to fill
the form when it opens so I put 'Call FillForm' with the Workbook Open code. *
This is where I get the error. *How do I difine the 'Sub FillSheet' is on a
different page of code?
Thanks
Doug

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm....mspx?mid=c9e6....


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Sub or Function not Defined

Ther are three different type VBA sheets in excel
1) thisworkbook - For workbook events
2) sheets - one every sheet in the workbook used for sheet events
3) Modules - Need to be added using menu Insert Module. Yo can add as many
modules as you want. common code should be place in a module

Create a module and put your code in the module.


Note: Subroutines called from the worksheet or button (not functions) cannot
have any parameters. Any subroutine or function can call another subroutine
or function with parameters. Subroutine called by worksheet/workboo events
have predefined parameters that cannot be changed.

"Doug" wrote:

I'm using Excel 2007. I have a form to input to a spreadsheet. I have 2
routines, 1 to put the information from the form to a sheet , Sub FillSheet
(), another to take information from the sheet and show it in labels on the
form, Sub FillForm (). I have a command button to run the code 'Call
FillSheet' and 'Call FillForm'. This works fine on the form. I want to fill
the form when it opens so I put 'Call FillForm' with the Workbook Open code.
This is where I get the error. How do I difine the 'Sub FillSheet' is on a
different page of code?
Thanks
Doug

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...el.programming

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sumproduct function / VB user defined function aw Excel Discussion (Misc queries) 3 September 23rd 08 09:05 AM
Using dcount function within user-defined worksheet function pongthai Excel Programming 3 January 15th 07 09:55 AM
Excel - User Defined Function Error: This function takes no argume BruceInCalgary Excel Programming 3 August 23rd 06 08:53 PM
Need to open the Function Arguments window from VBA for a user defined function. [email protected] Excel Programming 0 June 20th 06 03:53 PM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Excel Programming 1 August 6th 03 09:31 PM


All times are GMT +1. The time now is 04:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"