PC Review


Reply
Thread Tools Rate Thread

adding formula to cell

 
 
jodleren
Guest
Posts: n/a
 
      8th Oct 2008
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????



 
Reply With Quote
 
 
 
 
Richard Schollar
Guest
Posts: n/a
 
      8th Oct 2008
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" <(E-Mail Removed)> wrote in message
news:3290ad6a-4132-4251-9d33-(E-Mail Removed)...
> 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????
>
>
>


 
Reply With Quote
 
jodleren
Guest
Posts: n/a
 
      8th Oct 2008
On Oct 8, 12:16*pm, "Richard Schollar" <richardschol...@hotmail.com>
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a formula to the same cell (H5) on every tab John13 Microsoft Excel Discussion 5 4th Sep 2007 04:17 PM
adding a formula around a cell reference =?Utf-8?B?R3JlZWs3Nw==?= Microsoft Excel Misc 4 17th May 2007 10:32 PM
ADDING A FORMULA TO A CELL =?Utf-8?B?Z2VldmVzMTI5Mw==?= Microsoft Access Getting Started 5 25th Jul 2006 03:33 PM
Adding formula to a cell with VB Willow Microsoft Excel Programming 4 25th Jul 2006 12:28 PM
adding a formula in a cell but when cell = 0 cell is blank =?Utf-8?B?TWlrZSBU?= Microsoft Excel Worksheet Functions 5 31st May 2005 01:08 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:24 AM.