Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 40
Default add code to a cell via macro

ok i got the code to look a little cleaner.. it is still not working
but it is a lot 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:48 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 personal.xlsb!NumberIt('Revenue & Product Data'! A1) code just
extracts the company id number from cell a1 of the 'revenue & Product
data' sheet.

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
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
Macro code Shu of AZ Excel Discussion (Misc queries) 2 January 29th 07 06:29 PM
Help With Macro Code?? Neil Smith Excel Worksheet Functions 1 August 24th 06 07:40 PM
Macro code for dropping to next empty cell JB2010 Excel Discussion (Misc queries) 4 November 3rd 05 01:35 PM
Macro VB code help Anthony Excel Discussion (Misc queries) 4 October 8th 05 07:25 PM
Zip Code Macro Ken Wright Excel Worksheet Functions 0 December 9th 04 07:55 AM


All times are GMT +1. The time now is 09:23 PM.

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"