[AccessD] OT: Excel VBA - Formula versus Value

Darryl Collins Darryl.Collins at iag.com.au
Sun May 23 18:36:58 CDT 2010


_______________________________________________________________________________________

Note: This e-mail is subject to the disclaimer contained at the bottom of this message.
_______________________________________________________________________________________


Hi Asger,

Sheet1.Range("A1").Formula = "Sum(B1:B100)"
Is how you would use code to write a formula into an Excel Range(s).

varMyXLValue = Sheet1.Range("A1").value
Will return the value in the desired range

Hope that helps a bit

Cheers
Darryl

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Asger Blond
Sent: Sunday, 23 May 2010 9:57 AM
To: accessd at databaseadvisors.com
Subject: [AccessD] OT: Excel VBA - Formula versus Value

Writing Excel VBAs for years I've always used the property Value, and suddenly it strikes me:  What's the difference between Formula and Value?

Below examples lead to same result:

Range("A1").Value = "Test" 

Range("A1").Formula = "Test" 

Range("A1").Value = "=B1+B2" 

Range("A1").Formula = "=B1+B2"

Is Value versus Formula only a matter of code readability?

 

Asger

 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________________________________________________

The information transmitted in this message and its attachments (if any) is intended 
only for the person or entity to which it is addressed.
The message may contain confidential and/or privileged material. Any review, 
retransmission, dissemination or other use of, or taking of any action in reliance 
upon this information, by persons or entities other than the intended recipient is 
prohibited.

If you have received this in error, please contact the sender and delete this e-mail 
and associated material from any computer.

The intended recipient of this e-mail may only use, reproduce, disclose or distribute 
the information contained in this e-mail and any attached files, with the permission 
of the sender.

This message has been scanned for viruses.
_______________________________________________________________________________________




More information about the AccessD mailing list