Finance

Charts

Statistics

Macros

Search

Where Is User Function Code Written

To write a user-defined function, you need to go into the VBA editor. First, make sure that the Developer tab is displayed on the ribbon in Microsoft Office Excel 2010.

If it is not displayed, follow these steps:

  1. Go to the File tab on the ribbon and click Options.
  2. In the Excel Options window that opens, select Customize Ribbon from the list on the left, and on the right, in the Customize the Ribbon group, choose Main Tabs from the dropdown list.
  3. Check the box for Developer  and click OK.

Now, on the Developer tab, go to the Code group and click Visual Basic: the Integrated Development Environment (IDE) of the Visual Basic editor will open .

NOTE
To quickly launch the VBA editor, simply press the keyboard shortcut +.

The development environment has a standard interface typical of Windows applications: a title bar, a menu bar, a toolbar (in this case Standard), and two windows: Project – VBAProject and Properties.

In the Project – VBAProject window, all the modules and forms that are part of the project are listed. A module is displayed as a Module window, in which the main part is the working area — a sheet (not to be confused with an Excel worksheet), where the code is written. To open a module in the Project – VBAProject window, simply double-click the corresponding icon. The icon for the active module is highlighted in gray.

In VBA, each worksheet has its own module, and the workbook also has its own. Moreover, if user forms are created in the project, each of them also has its own module. You can add class modules to the project to describe custom classes. However, to create a user-defined function, you will need a standard module, which can be added to the project with the command:
Insert | Module.

0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest
0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
Online comments
Show all comments
Facebook
Twitter
LinkedIn
WhatsApp
Email
Print
0
We’d love to hear your thoughts — please leave a commentx