Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Pivot Table Page Field value from cell in another worksheet

I have looked through the other posts on the subject and the combination of
my low skills in VB and the other solutions not exactly covering my situation
means I still need to ask for help.

Scenario:

Worksheet a = "Scorecard"
FieldName = "CustomerNumber"

Worksheet b = "Products Resume"
PivotTable = "PivotTable2"
PivotTable Page Field = "Account Number"

When CustomerNumber value on worksheet "Scorecard" is changed I need the
Pivot Table Page field "Account Number" to use this value to filter the pivot
table.

I have received some help for this problem and got this far -

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("CustomerNumber").Address Then
Me.PivotTables(2).PivotFields("Account Number").CurrentPage =
Range("CustomerNumber").Value
Me.PivotTables(2).PivotCache.Refresh
End If
End Sub

.....but I get the error

"method 'PivotTables' of object '_Worksheet' failed

Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 376
Default Pivot Table Page Field value from cell in another worksheet

Hi

How many Pivot Tables do you have on worksheet b?
If there is only 1, then change the code to
PivotTables(1)
in both instances within the code

Alternatively, be specific and use
PivotTables("PivotTable2")
in both instances
--
Regards
Roger Govier

kernel wrote:
I have looked through the other posts on the subject and the combination of
my low skills in VB and the other solutions not exactly covering my situation
means I still need to ask for help.

Scenario:

Worksheet a = "Scorecard"
FieldName = "CustomerNumber"

Worksheet b = "Products Resume"
PivotTable = "PivotTable2"
PivotTable Page Field = "Account Number"

When CustomerNumber value on worksheet "Scorecard" is changed I need the
Pivot Table Page field "Account Number" to use this value to filter the pivot
table.

I have received some help for this problem and got this far -

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("CustomerNumber").Address Then
Me.PivotTables(2).PivotFields("Account Number").CurrentPage =
Range("CustomerNumber").Value
Me.PivotTables(2).PivotCache.Refresh
End If
End Sub

....but I get the error

"method 'PivotTables' of object '_Worksheet' failed

Any ideas?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Pivot Table Page Field value from cell in another worksheet

Hi,

Thanks for the response. I changed the code to -

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = Range("CustomerNumber").Address Then
Me.PivotTables("PivotTable2").PivotFields("Account Number").CurrentPage
= Range("CustomerNumber").Value
Me.PivotTables("PivotTable2").PivotCache.Refresh
End If
End Sub

.....but I am still getting the "method 'PivotTables' of object '_Worksheet'
failed" error.



"Roger Govier" wrote:

Hi

How many Pivot Tables do you have on worksheet b?
If there is only 1, then change the code to
PivotTables(1)
in both instances within the code

Alternatively, be specific and use
PivotTables("PivotTable2")
in both instances
--
Regards
Roger Govier

kernel wrote:
I have looked through the other posts on the subject and the combination of
my low skills in VB and the other solutions not exactly covering my situation
means I still need to ask for help.

Scenario:

Worksheet a = "Scorecard"
FieldName = "CustomerNumber"

Worksheet b = "Products Resume"
PivotTable = "PivotTable2"
PivotTable Page Field = "Account Number"

When CustomerNumber value on worksheet "Scorecard" is changed I need the
Pivot Table Page field "Account Number" to use this value to filter the pivot
table.

I have received some help for this problem and got this far -

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("CustomerNumber").Address Then
Me.PivotTables(2).PivotFields("Account Number").CurrentPage =
Range("CustomerNumber").Value
Me.PivotTables(2).PivotCache.Refresh
End If
End Sub

....but I get the error

"method 'PivotTables' of object '_Worksheet' failed

Any ideas?

.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 376
Default Pivot Table Page Field value from cell in another worksheet

Hi

If you want to mail me a copy of the workbook, I will take a look.
Mail to
roger at technology4u dot co dot uk
Change the at to @ and dots to . and remove spaces, to make a valid
eamil address
--
Regards
Roger Govier

kernel wrote:
Hi,

Thanks for the response. I changed the code to -

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = Range("CustomerNumber").Address Then
Me.PivotTables("PivotTable2").PivotFields("Account Number").CurrentPage
= Range("CustomerNumber").Value
Me.PivotTables("PivotTable2").PivotCache.Refresh
End If
End Sub

....but I am still getting the "method 'PivotTables' of object '_Worksheet'
failed" error.



"Roger Govier" wrote:

Hi

How many Pivot Tables do you have on worksheet b?
If there is only 1, then change the code to
PivotTables(1)
in both instances within the code

Alternatively, be specific and use
PivotTables("PivotTable2")
in both instances
--
Regards
Roger Govier

kernel wrote:
I have looked through the other posts on the subject and the combination of
my low skills in VB and the other solutions not exactly covering my situation
means I still need to ask for help.

Scenario:

Worksheet a = "Scorecard"
FieldName = "CustomerNumber"

Worksheet b = "Products Resume"
PivotTable = "PivotTable2"
PivotTable Page Field = "Account Number"

When CustomerNumber value on worksheet "Scorecard" is changed I need the
Pivot Table Page field "Account Number" to use this value to filter the pivot
table.

I have received some help for this problem and got this far -

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("CustomerNumber").Address Then
Me.PivotTables(2).PivotFields("Account Number").CurrentPage =
Range("CustomerNumber").Value
Me.PivotTables(2).PivotCache.Refresh
End If
End Sub

....but I get the error

"method 'PivotTables' of object '_Worksheet' failed

Any ideas?

.

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
Pivot Table Page Field Nate Excel Discussion (Misc queries) 4 December 24th 07 03:11 PM
Excel Pivot Table link page field to spreadsheet cell excel misc Excel Discussion (Misc queries) 1 March 21st 07 11:18 PM
Pivot Table Page field link to cell Santhosh Mani Excel Worksheet Functions 0 May 12th 05 05:58 AM
Pivot Table Page Field Neily Excel Discussion (Misc queries) 3 February 24th 05 01:23 PM
Pivot Table Page Field Jimbola Excel Discussion (Misc queries) 0 February 6th 05 09:13 PM


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