LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Inserting a formula into a cell

Hi everybody,

I have a little problem concerning Formulas in Excel VBA.

I want to insert the following code into an cell using VBA:
=GETPIVOTDATA("Cost ";'Reports.xls'pivotYear;"Year";2003)

Of course, I want to create this statement generic, e.g.:
Range("G5").FormulaR1C1 = "=GETPIVOTDATA(""" & pos &
""";'Reports.xls'!" & pivot & ";""Year"";2003)"

I have tested the syntax of the string and it is identically to the
string above. The problem is now that I receive an error message when
it comes to this statement: Range("G5").FormulaR1C! = "..."
Error message: Application-defined or Object-defined error

I would be very grateful, if somebody could help me how to do it
properly! THANKS!


Best wishes,
Stephan
 
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
Inserting formula in the cell below Raj[_2_] Excel Worksheet Functions 1 August 1st 09 03:26 AM
Inserting formula in the cell below Raj[_2_] Excel Worksheet Functions 0 August 1st 09 02:49 AM
Problem After Inserting Cell Formula Rick Excel Discussion (Misc queries) 1 December 28th 07 07:12 PM
help with inserting a cell value into a named formula Ed Excel Discussion (Misc queries) 1 November 25th 05 10:14 PM
inserting data from a row to a cell, when the row number is specified by a formula in a cell [email protected] New Users to Excel 2 January 6th 05 07:18 AM


All times are GMT +1. The time now is 10:33 AM.

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"