Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 3 - User-defined Functions using Visual Basic ...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

User-defined Functions using Visual Basic Applications in Excel
By: Codex-M
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2009-08-06

    Table of Contents:
  • User-defined Functions using Visual Basic Applications in Excel
  • Understanding Excel Function Programming Steps
  • Programming Syntax
  • Basic Code Example

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    User-defined Functions using Visual Basic Applications in Excel - Programming Syntax


    (Page 3 of 4 )

    As with any piece of programming code, user-defined functions in MS Excel also follow a set of rules when it comes to proper syntax.

    Below is the standard syntax:

    Function Functionname(Variable)

    <Visual basic source code of your function here>

    End Function

    It should start with the syntax “Function” and then end with the “End Function.”

    This tells Visual Basic that we are running an Excel function. Concepts will be very hard to understand without real-world examples.

    We would like to make a user-defined Excel function that will automatically compute the monthly electricity bill (in dollars) given the power rating of the home appliance, the number of appliances involved (units) and the number of hours in operation.

    In classic Microsoft Excel using built-in functions, the following is the Excel table using the lengthy computational processes:

    Note that there are a lot of computations involved, and it takes up a lot of computational space. We will attempt to write a user-defined function in Visual Basic that will compute the cost automatically given the power rating (watts) of each home appliances.

    More Visual Basic.NET Articles
    More By Codex-M


       · I like so much this. Very important to my desenvolviment.
     

    VISUAL BASIC.NET ARTICLES

    - Clocks and Countdowns
    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek