BTW, I think a limited version of VB is now distributed in the MS-Office packs and is usually accessed by pressing Alt+F11(or clicking on the menu: Tools->Macro->VB editor).
For your sample, you would enter something like this in the VB code module(be aware, Evaluate may be a reserved word so in this example I'll call it EvaluateX).
My VB is very rusty so I'll just write a basic pseudocode.(it's not a very powerfull programming language at all IMHO, but it's MS's plaything so we have to deal with it lol)
Function EvaluateX(CellCmd As String)
Dim CellValA As Variant
Dim CellValB As Variant
Dim MathsSymbol As Long
{Write code that scans the string sent to the function and stores the sum type(eg +,-,* etc), and the two cell values into the defined variables}
{You would then most likely have several different blocks of code depending which maths symbol is being used, separated by an if/case statement, for example in the + symbols code you would have something like}
EvaluateX = CellValA + CellValB
{and the - symbols code you would have something like}
EvaluateX = CellValA - CellValB
End Function
Then in Excel you would call it by entering into the desired cell "=EvaluateX(A1)"
- Forums
- ASX - By Stock
- HDR
- excel experts required
HDR
hardman resources limited
excel experts required, page-5
-
-
- There are more pages in this discussion • 5 more messages in this thread...
You’re viewing a single post only. To view the entire thread just sign in or Join Now (FREE)