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: 17
Default Loading pivot table problem

Hello,

I have a macro that has stopped working. The macro generates a pivot
table from a populate that is constantly changing in row and column
size. Recently the variable "PivRng" has stopped working. I have added
a watch to it and it shows that the range has only 1 row, 1 column,
and I don't understand why. The variables "FR" and "FC" are returning
the correct values. I don't get it, please help!

Sub FinNetPiv()
Dim aWB As Workbook, PivC As PivotCache, NetPop As Worksheet,
NetPiv As Worksheet, FR As Long, FC As Long, piv As PivotTable

Set aWB = ActiveWorkbook
Set NetPop = aWB.Worksheets("Nettable Pop")

'finalRow and finalCol for new sheet
FR = NetPop.Cells(Rows.Count, 8).End(xlUp).Row
FC = NetPop.Cells(1, Columns.Count).End(xlToLeft).Column

Application.ScreenUpdating = False

'add piv worksheet
Set NetPiv =
Worksheets.Add(After:=Worksheets("Nettable Pop"))
On Error Resume Next
NetPiv.Name = "Net Piv"
PROBLEM 'set range
Dim PivRng As Range
Set PivRng = NetPop.Cells(1, 1).Resize(FR, FC)

'set piv cache
Set PivC =
aWB.PivotCaches.Add(SourceType:=xlDatabase,
SourceData:=PivRng.Address)
Set piv =
PivC.CreatePivotTable(Tabledestination:=NetPiv.Ran ge("A3"),
tablename:="FinNet")
 
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
Pivot table problem George Excel Discussion (Misc queries) 4 April 25th 10 04:39 PM
Problem inserting calculated pivot fields into Pivot Table (2007) wamiller36 Excel Discussion (Misc queries) 1 March 5th 10 11:40 PM
Pivot table problem PsyberFox Excel Discussion (Misc queries) 1 February 28th 08 09:52 PM
Pivot Table in Excel 2007 : Problem with % in Table spudsnruf Excel Discussion (Misc queries) 2 January 9th 08 09:53 PM
Pivot Table Problem Terence[_2_] Excel Programming 1 July 19th 03 04:14 PM


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