Excel VBA formulas for Spreadsheet by Sharath Kumar Peechara - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Exercise 16: Convert VBA Function to Excel Function

 

  1. Create a UDF (User Defined Function)
  2. Use Defined Name

To create this Function, execute the following steps

  1. Open Excel VBA (Alt + F11)
  2. Insert a New Module
  3. In the Project Explorer, double click on the Module
  4. Add the following code line:

Use the FIX Function of Excel VBA code lines function to use it in Excel sheet ,Insert the below code in a New Module.

img30.png

This Will Create A new UDF (User Defined Function) with name Stdyr() we Can use this As we Required. type in Excel the function As = Stdyr(), the UDF Comes up in the year as 2016 which is constant figure

Keep the Cell Format as General In Spreadsheet

img31.jpg

This Code lines will create function Stdyr()

In Cell A1 Type

= Stdyr(A1)

2. Defined Name

Click on Formulas img32.pngDefined Formulasimg32.png Define Name

Define Name for Any cell With Value “2016 “, Type in any cell As =stdyr