Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default adding formula to cell

Hi


I seem to have problems to add a formula to a cell.

I generat a string like "=SUM(A1;H7;U7)" and apply it like

ActiveSheet.Cells(y + k + 1, x + 1).Value = sValue
ActiveSheet.Cells(y + k + 1, x + 1).Text = sValue
ActiveSheet.Cells(y + k + 1, x + 1).Formula = sValue

and the all give an "object error"

why????



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default adding formula to cell

Hi

You should use the Formula property, not Value (and certainly not Text,
which is read only).

Try removing the semi-colons from the string and replacing with commas (even
though I presume your excel version uses ; in formulas). So sValue becomes:

sValue = SUM(A1,H7,U7)


Richard


"jodleren" wrote in message
...
Hi


I seem to have problems to add a formula to a cell.

I generat a string like "=SUM(A1;H7;U7)" and apply it like

ActiveSheet.Cells(y + k + 1, x + 1).Value = sValue
ActiveSheet.Cells(y + k + 1, x + 1).Text = sValue
ActiveSheet.Cells(y + k + 1, x + 1).Formula = sValue

and the all give an "object error"

why????




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default adding formula to cell

On Oct 8, 12:16*pm, "Richard Schollar"
wrote:
Hi

You should use the Formula property, not Value (and certainly not Text,
which is read only).

Try removing the semi-colons from the string and replacing with commas (even
though I presume your excel version uses ; in formulas). *So sValue becomes:

sValue = SUM(A1,H7,U7)


Thanks, that's helped
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
Adding formula to a cell with VB Willow[_6_] Excel Programming 4 July 25th 06 12:28 PM
formula for adding every other cell in Excel Michelle Odell Excel Worksheet Functions 2 January 23rd 06 05:30 PM
adding a formula in a cell but when cell = 0 cell is blank Mike T Excel Worksheet Functions 5 May 31st 05 01:08 AM
Adding a prefix to a cell by using a formula Audrey in OHIO Excel Discussion (Misc queries) 4 February 24th 05 04:49 PM
Adding a comment to a formula-not a cell Floridagal Excel Discussion (Misc queries) 4 January 6th 05 12:23 AM


All times are GMT +1. The time now is 05:59 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"