Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default can someone help me with these 8 lines of code

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default can someone help me with these 8 lines of code

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('Reve nue & Product Data'!
A1,""CU_CODE," & Range("A" & i).Value)""


On Apr 19, 3:22 pm, mithu 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default can someone help me with these 8 lines of code


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
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
Three lines of code that I can't understand Grd Excel Programming 8 February 11th 07 01:15 AM
How to see how many lines of code ? SpookiePower Excel Programming 3 January 25th 06 03:01 AM
Code to write out all lines of code davidm Excel Programming 3 August 5th 05 04:26 AM
Help Please: Need code to test several lines bruce forster Excel Programming 3 April 7th 04 04:27 AM
Lines fo code Neeraja[_2_] Excel Programming 2 October 16th 03 01:07 PM


All times are GMT +1. The time now is 05:52 PM.

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"