Why Evaluate?
With Evaluate you don't have to decide at design time what to
evaluate. A possible use: say that you wanted to create a function-
grapher, something which takes a user-supplied mathematical expression
and plots it on an x-y coordinate system. You could grab the
expression to be graphed and with a sub take the expression,
substitute numbers for the variable x and invokes Evaluate to generate
the y-values to be plotted. I'm sure others can think of some other
uses.
-John Coleman
On Mar 3, 11:24 pm, "Dave Unger" wrote:
Hello everyone,
I realize this probably sounds ridiculous, but maybe someone can
explain the purpose of the Evaluate method to me. If I replace the
VBA help examples with the following code, I get the same results:
VBA Help examples
Evaluate("A1").Value = 25
trigVariable = Evaluate("SIN(45)")
Set firstCellInSheet = Workbooks("BOOK1.XLS").Sheets(4).Evaluate("A1")
My Code
Range("A1").Value = 25
trigVariable = Sin(45)
Set firstCellInSheet = Workbooks("BOOK1.XLS").Sheets(4).Range("A1")
Searching the groups turns up numerous examples of using Evaluate, but
I have been unable to figure out "why" use Evaluate. Somewhere, I'm
missing something.
Thank you for your help,
Regards,
DaveU
|