ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   formula through vb code (https://www.excelbanter.com/excel-programming/340427-formula-through-vbulletin-code.html)

Jonsson[_48_]

formula through vb code
 

Hi

How to define a formula through vb code into excel range?

//Thomas


--
Jonsson
------------------------------------------------------------------------
Jonsson's Profile: http://www.excelforum.com/member.php...fo&userid=5472
View this thread: http://www.excelforum.com/showthread...hreadid=468654


Norman Jones

formula through vb code
 
Hi Thomas,

Look at the 'FormulaR1C1 Property' and 'Formula Property' in VBA help and
see also the examples provided,


---
Regards,
Norman



"Jonsson" wrote in
message ...

Hi

How to define a formula through vb code into excel range?

//Thomas


--
Jonsson
------------------------------------------------------------------------
Jonsson's Profile:
http://www.excelforum.com/member.php...fo&userid=5472
View this thread: http://www.excelforum.com/showthread...hreadid=468654




Tom Ogilvy

formula through vb code
 
Range("B10").Formula = "=Sum($B$1:$B$9)"

--
Regards,
Tom Ogilvy


"Jonsson" wrote in
message ...

Hi

How to define a formula through vb code into excel range?

//Thomas


--
Jonsson
------------------------------------------------------------------------
Jonsson's Profile:

http://www.excelforum.com/member.php...fo&userid=5472
View this thread: http://www.excelforum.com/showthread...hreadid=468654




Mac Lingo[_2_]

formula through vb code: A solution
 
Make up the range statement and then store it in the Excel Names Store.

You put it in with
ActiveWorkbook.Names("Name").Delete
ActiveWorkbook.Names.Add Name:="Name", RefersToR1C1:=String
where "Name" is the way you will reference it later.

You can get it back with
Temp = ActiveWorkbook.Names("Name").Value
with a little tinkering to get off the "=" the quotes.

Good luck,
Mac Lingo



Jonsson[_49_]

formula through vb code
 

Thanks, IŽll try that

//Thomas


--
Jonsson
------------------------------------------------------------------------
Jonsson's Profile: http://www.excelforum.com/member.php...fo&userid=5472
View this thread: http://www.excelforum.com/showthread...hreadid=468654



All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com