Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
formula or vba code Nader Excel Worksheet Functions 14 August 16th 06 10:54 AM
Add formula in the code Annette[_5_] Excel Programming 3 February 21st 05 08:19 PM
Help with my code and formula yh73090[_2_] Excel Programming 1 August 30th 04 06:06 AM
formula to code help JohnE Excel Programming 2 February 28th 04 01:27 AM
Formula or code Jim[_15_] Excel Programming 0 July 9th 03 05:51 PM


All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"