View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Debra Dalgleish Debra Dalgleish is offline
external usenet poster
 
Posts: 2,979
Default Pivotfields.CurrentPage

You could check for a parenthesis at the left of the string. For example:

'================================
Private Sub Worksheet_Change(ByVal Target As Range)
Dim pt As PivotTable
Dim pf As PivotField
Dim str As String
Set pt = ActiveSheet.PivotTables(1)
Set pf = pt.PageFields(1)
str = Left(pt.PivotFields(pf.Name).CurrentPage, 1)

If str = "(" Then
MsgBox "(All) was selected"
Else
'do nothing

End If

End Sub
'=================================

Daniel Magnus Bennét Björck wrote:
Hi!

I have a spreadsheet with some dropdown boxes where you can make selections
which will then filter the data for the regular calculations. There is also
a Pivot Chart which I'm linking to the same dropdown boxes by manipulating
the pages to set to the same values by using CurrentPage.

That works fine, but how do I catch when the user selects nothing from the
dropdown? Currently I set the CurrentPage to "(all)" which does the trick,
but this workbook is used in other countries with non-english installations,
where the pivotfield instead will say "(toutes)","(alle)", etc. How do I
solve it for them? I have tried finding some form of Index I could set
(Currentpage.Index=0 for instance) unsuccessfully. Or is there a way to find
out what "(all)" is called in the local installation?

Brgds

Danny




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html