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: 3
Default Validation fields linked to pivot tables on separate worksheets

Hi all,

Can anyone please help. I have a very basic knowledge of VB in Excel
and have found a piece of code to change any pivot table in my
workbook to match my validation drop down box. The problem is that I
wish to expand this to use a further 3 validation (drop down boxes).
Can anyone show me the extra VB code I would need?

The current working validation box is located in "Sales zone" in cell
C6

The additional fields I want to use are located in cells:

"Market Area" in cell C7
"Centre name" in cell C8
"Centre No" in cell C9


The Current VB code for working one drop down validation box is:

Option Explicit


Private Sub Worksheet_Change(ByVal Target As Range)

Dim ws As Worksheet
Dim pt As PivotTable
Dim pi As PivotItem
Dim strField As String

strField = "Sales zone"

On Error Resume Next
Application.EnableEvents = False
Application.ScreenUpdating = False

If Target.Address = Range("C6").Address Then

For Each ws In ThisWorkbook.Worksheets
For Each pt In ws.PivotTables
With pt.PageFields(strField)
For Each pi In .PivotItems
If pi.Value = Target.Value Then
.CurrentPage = Target.Value
Exit For
Else
.CurrentPage = "(All)"
End If
Next pi
End With
Next pt
Next ws

End If

Application.EnableEvents = True
Application.ScreenUpdating = True

End Sub

 
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
Update linked pivot tables when page changes in main pivot Needing Help Excel Discussion (Misc queries) 0 May 9th 09 11:11 PM
Is there a way to reference 2 separate worksheets with validation Erik Excel Worksheet Functions 1 June 13th 07 07:25 PM
Linked Cells on Separate Worksheets Visual Calendar Dilemma Excel Discussion (Misc queries) 0 September 25th 06 10:34 PM
row fields in pivot tables saeed Excel Discussion (Misc queries) 2 May 7th 05 02:46 AM
Validation Tables For Drop Down list on a Separate Worksheet. azelli1 Excel Worksheet Functions 3 February 10th 05 01:52 PM


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