Application.Evaluate
This converts the name of an object to its actual value.
Using Application.Evaluate is identical to using [square brackets] around your argument.
The only reason people use the square brackets is that it is shorter
The advantage of using the Evaluate function is that the argument is a string so it is possible to construct the string from code.
Excel
This function can be used with the following different types of objects.
A1 style cell references. All references are considered to be absolute.
Ranges. Including union and interset operators (colon, space and comma)
Named Ranges
External cell references in other worksheets or workbooks
Chart object names such as "Legend", "Plot Area", "Series 1" to access the corresponding properties and methods.
Application.Evaluate ("A1").Value = 10
[A1].Value = 10
sngVariable = Application.Evaluate["Sin(40)"]
sngVariable = [Sin(40)]
rgeCell = Workbooks("Book1").Sheets(2).[A1]
Application.Evaluate ("namedrange")
Application.Evaluate ("[Book2.xls]Sheet1!B2")
Charts("Char1").Evaluate("Legend").Font.Name = "Arial"
Evaluating Functions
This cannot evaluate analysis toolpak function unless the Analysis Toolpak-VBA is installed.
Word
The method Application.Evaluate does not exist in Word at the moment
PowerPoint
The method Application.Evaluate does not exist in PowerPoint at the moment
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext