PC Review


Reply
Thread Tools Rate Thread

can someone help me with these 8 lines of code

 
 
mithu
Guest
Posts: n/a
 
      19th Apr 2007
hello.. i am writing code that allows a worksheet to access data from
a pivot table in my personal.xlsb workbook. i pass in a workbook to
this function.

the cells i am trying to enter this quoted getpivotdata formuls start
in e20 and go to e60.

i made a variable called i to reperesent the row number

this is my code

Dim i As Integer
i = 20
Do

mybook.Worksheets("Product Breakout").Range("E"&i).Value =
"=GETPIVOTDATA(" & "YTD Total Units" & ",[PERSONAL.XLSB]unitqty!$A$3,"
& "SIEBELLINKID" & ",personal.xlsb!NumberIt('Revenue & Product Data'!
A1)," & "CU_CODE" & ",range(A" & i&").value)"

i = i + 1
Loop While i < 61

the part of the code that says range(A"&i&").value pulls the value of
column a for which ever row the counter is in. can someone help me
fix this please

 
Reply With Quote
 
 
 
 
mithu
Guest
Posts: n/a
 
      19th Apr 2007
ok so i did a record macro and i got this far.. i am still getting an
error but the code looks cleaner
mybook.Worksheets("Product Breakout").Range("A" & i).Value = _
"=GETPIVOTDATA(""YTD Total Units"",[PERSONAL.XLSB]unitqty!
R3C1,""SIEBELLINKID"",personal.xlsb!NumberIt('Revenue & Product Data'!
A1,""CU_CODE," & Range("A" & i).Value)""


On Apr 19, 3:22 pm, mithu <mith...@gmail.com> wrote:
> hello.. i am writing code that allows a worksheet to access data from
> a pivot table in my personal.xlsb workbook. i pass in a workbook to
> this function.
>
> the cells i am trying to enter this quoted getpivotdata formuls start
> in e20 and go to e60.
>
> i made a variable called i to reperesent the row number
>
> this is my code
>
> Dim i As Integer
> i = 20
> Do
>
> mybook.Worksheets("Product Breakout").Range("E"&i).Value =
> "=GETPIVOTDATA(" & "YTD Total Units" & ",[PERSONAL.XLSB]unitqty!$A$3,"
> & "SIEBELLINKID" & ",personal.xlsb!NumberIt('Revenue & Product Data'!
> A1)," & "CU_CODE" & ",range(A" & i&").value)"
>
> i = i + 1
> Loop While i < 61
>
> the part of the code that says range(A"&i&").value pulls the value of
> column a for which ever row the counter is in. can someone help me
> fix this please



 
Reply With Quote
 
cathellisuk@yahoo.co.uk
Guest
Posts: n/a
 
      19th Apr 2007

Mithu,
is the problem with

""CU_CODE," & Range("A" & i).Value)""

since you have double quotes at either end maybe Excel is taking all
the characters in the middle as a single string and therefore not
evaluating "A" & i as A1 , A2 etc

Have you tried ....

""CU_CODE," & Range("A" "" & i & "" ).Value)"" or something like
that.

Catherine



 
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 code lines with vba code thread Microsoft Excel Programming 4 6th Feb 2008 01:31 PM
Code to write out all lines of code davidm Microsoft Excel Programming 3 5th Aug 2005 04:26 AM
Inserting blank lines breaks lines of code BradC Microsoft VB .NET 3 8th Dec 2004 07:09 PM
How many lines of code does Win XP/98 have? =?Utf-8?B?cm9qYWs=?= Windows XP General 19 17th Jun 2004 06:49 AM
Need a few lines of code help, will pay! Robert Johnson Microsoft ASP .NET 3 4th Aug 2003 07:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:22 PM.