Thursday, March 13, 2008

What is Excel Programming?

MS-EXCEL can be programmed to meet our custom requirement effectively. An EXCEL prgrammer write code in VBA (Visual Basic for Applications). Hence it is also called as EXCEL-VBA Programming.

So any existing VB Programmer can do EXCEL prgramming.

Here is a simple solution to add two numbers. It is just to show how to write VBA Functions. So dont argue with me what is the use of this solution. I know that the simple and well known cell formula =A1+B1 will do this.
  • Start Visual Basic Editor using TOOLS / MACRO / Visual Basic Editor. (I use ALT+F11 key combination!!!)
  • Insert a module (Insert / Module)
  • Type the following in the module

Public Function add(ByVal a As Integer, ByVal b As Integer) As Long

add = a + b

End Function

  • Now in the worksheet type the following table


TRAVEL FOOD TOTAL

JAN-08 230 430 =add(a1,b1)

FEB-08 210 545 copy the above formula

  • In the total column enter the following formula =add(a2,b2) and drag below.

I hope that this will give you a fundamental idea for novice user. For advanced use, they can write many sophisticated function in this way.

Feel free to contact me for any assistance (ofcourse I will assist you free of cost only). karthiganesh@yahoo.com

No comments:

Post a Comment