Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how do i include an excel formula in a vb string?

Hi,

Am trying to build a Macro which will deposit an excel formala into an excel
field if certain criteria are met. However - when i include a string along
the lines of "=SUM(A1:A4)" the vb scipt will kick it out when it hits the
first parenthesis as if it isn't accepting the character type within the
string.

Any suggestions of how i get round this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default how do i include an excel formula in a vb string?

In VBA,

If you want to insert a worksheet function into a cell do this.

Worksheets("Sheet1").Range("B1").Formula = "=SUM(A1:A4)"



"Washballs" wrote in message
...
Hi,

Am trying to build a Macro which will deposit an excel formala into an
excel
field if certain criteria are met. However - when i include a string along
the lines of "=SUM(A1:A4)" the vb scipt will kick it out when it hits the
first parenthesis as if it isn't accepting the character type within the
string.

Any suggestions of how i get round this?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default how do i include an excel formula in a vb string?

Hi,

This should do it

Range("B1").Formula = "=SUM(A1:A4)"

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Washballs" wrote:

Hi,

Am trying to build a Macro which will deposit an excel formala into an excel
field if certain criteria are met. However - when i include a string along
the lines of "=SUM(A1:A4)" the vb scipt will kick it out when it hits the
first parenthesis as if it isn't accepting the character type within the
string.

Any suggestions of how i get round this?

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
How to read a string in excel and include the single quote Ricky Excel Discussion (Misc queries) 3 September 4th 09 04:46 PM
replace all the cells in sheet that include spsific string-via mac Miri Excel Programming 1 January 14th 08 11:07 AM
How do you include a quotation as part of a string ?? Dan Thompson Excel Programming 2 November 4th 06 06:11 AM
How can I include a " in my string? Ai_Jun_Zhang Excel Programming 1 August 3rd 05 12:49 AM
How to include a double quotation character in a string? Georgee Excel Programming 2 August 17th 04 06:41 AM


All times are GMT +1. The time now is 04:29 PM.

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

About Us

"It's about Microsoft Excel"