[AccessD] OT: Excel VBA - Formula versus Value

Bill Benson (vbacreations) vbacreations at gmail.com
Sun May 23 20:09:16 CDT 2010


I prefer

Range("A1").Formula = "=" & "S" & "u" & "m" & "(" & Chr$(66) & "1" & ":" &
Chr$(66) & ThisWorkbook.Names("BILLS_IQ").RefersToRange.Value & ")"

An er, the formula result is the same...
 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darryl Collins
Sent: Sunday, May 23, 2010 8:15 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] OT: Excel VBA - Formula versus Value


____________________________________________________________________________
___________

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



Uh ah.......

Sheet1.Range("A1").Formula = "=Sum(B1:B100)"

Would be the correct syntax.  Unlike my original post without the attitional
"=" sign. (thanks Bill!).


 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darryl Collins
Sent: Monday, 24 May 2010 9:37 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] OT: Excel VBA - Formula versus Value


____________________________________________________________________________
___________

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.
____________________________________________________________________________
___________

-- 
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.
____________________________________________________________________________
___________

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.819 / Virus Database: 271.1.1/2887 - Release Date: 05/23/10
02:26:00





More information about the AccessD mailing list