Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default please help with get pivotdata formula

i am having trouble with this code. I am trying to pull data from a
pivot table i created in my personal.xlsb workbook..

Variable "sid" pulls the company code from another workbook. this
works perfectly. but the error happens when i enter the do while
loop, when i want to place the getpivotdata formula in the cell.
can someone please help me with this. I think the problem is
happening due to my quotes.. because i am trying to pull values from
variables in my code and insert them into the string. i cant seem to
figure out if my quotes are just in the wrong place.. or if i am just
not doing it correctly. .

If anyone would be kind enough to help me Iwould greatly appriciate
it.
here is my code

Dim sid As Double
Dim i As Integer

sid = Application.Run("'personal.xlsb'!Numberit",
mybook.Worksheets("Revenue & Product Data").Range("A1"))
i = 20

Do While i < 61
Range("E" & i).Select
ActiveCell.FormulaR1C1 = _
"=GETPIVOTDATA(""YTD Total Units"",[PERSONAL.XLSB]Sheet5!
R3C1,""SIEBELLINKID""," & CStr(sid) & ",""CU_CODE"",$A" & CStr(i) &
")"
i = i + 1

Loop

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default please help with get pivotdata formula

If I replace you variables with string constants ("---") I get

? "=GETPIVOTDATA(""YTD Total
Units"",[PERSONAL.XLSB]Sheet5!R3C1,""SIEBELLINKID""," & "---" &
",""CU_CODE"",$A" & "---" & ")"
=GETPIVOTDATA("YTD Total
Units",[PERSONAL.XLSB]Sheet5!R3C1,"SIEBELLINKID",---,"CU_CODE",$A---)

from the immediate window. Is that what you want (the last part of the
formula looks suspect - but it is difficult to know what you are trying to
achieve).

Anyway, the quotes don't appear to be the problem in most of your formula.

--
Regards,
Tom Ogilvy

"mithu" wrote:

i am having trouble with this code. I am trying to pull data from a
pivot table i created in my personal.xlsb workbook..

Variable "sid" pulls the company code from another workbook. this
works perfectly. but the error happens when i enter the do while
loop, when i want to place the getpivotdata formula in the cell.
can someone please help me with this. I think the problem is
happening due to my quotes.. because i am trying to pull values from
variables in my code and insert them into the string. i cant seem to
figure out if my quotes are just in the wrong place.. or if i am just
not doing it correctly. .

If anyone would be kind enough to help me Iwould greatly appriciate
it.
here is my code

Dim sid As Double
Dim i As Integer

sid = Application.Run("'personal.xlsb'!Numberit",
mybook.Worksheets("Revenue & Product Data").Range("A1"))
i = 20

Do While i < 61
Range("E" & i).Select
ActiveCell.FormulaR1C1 = _
"=GETPIVOTDATA(""YTD Total Units"",[PERSONAL.XLSB]Sheet5!
R3C1,""SIEBELLINKID""," & CStr(sid) & ",""CU_CODE"",$A" & CStr(i) &
")"
i = i + 1

Loop


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
Regression Leverage Formula (Jerry W. Lewis or Mike Middleton)already have DFITS formula PJ[_3_] Excel Worksheet Functions 2 June 2nd 10 03:45 PM
Excel 2002 Formula: Urgent Conditional Formula Required Right Away - if possible blue[_2_] Excel Discussion (Misc queries) 2 July 11th 07 06:08 PM
Formula expected end of statement error, typing formula into cell as part of VBA macro [email protected] Excel Programming 1 July 20th 06 07:58 PM
Cell doesn't show formula result - it shows formula (CTRL + ' doe. o0o0o0o Excel Worksheet Functions 6 November 19th 04 03:13 PM
Commenting custom formula fields/formula on formula editor Muxer Excel Programming 2 July 24th 03 01:02 AM


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