Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default user forms and pivot tables question

Hello
I would like to have a drop down list in a user form to select a value, in
my case a month, that will select the matching value from the manual filter
(on the column labels) or the report filter options in a pivot table.

Any help would be greatly appreciated
cheers ben

My pivot table looks a little like this:
Sum of TOTAL $ month DATE
January February
Category 12/01/2007 19/01/2007 20/01/2007 21/01/2007 2/02/2007 3/02/2007
Apartment rent 1500 1500
Assistant salary 580 580
Bank Commission 22 55
Car petrol 33 23.53


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,886
Default user forms and pivot tables question

Hi

Take a look at the GetPivotData function.
You can find more information on this and its application at Debra
Dalgleish's site
http://www.contextures.com/xlPivot06.html

--
Regards

Roger Govier


"bennyob" wrote in message
...
Hello
I would like to have a drop down list in a user form to select a
value, in
my case a month, that will select the matching value from the manual
filter
(on the column labels) or the report filter options in a pivot table.

Any help would be greatly appreciated
cheers ben

My pivot table looks a little like this:
Sum of TOTAL $ month DATE
January February
Category 12/01/2007 19/01/2007 20/01/2007 21/01/2007 2/02/2007
3/02/2007
Apartment rent 1500 1500
Assistant salary 580 580
Bank Commission 22 55
Car petrol 33 23.53




  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default user forms and pivot tables question

Thanks for the link, not what I am looking for but I sure can use this
function elsewhere.

What I am trying looks like this, but I have a bug in the 'pi.Visible =
True" line:

Sub Macro1()
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Dim strMon As String

Application.ScreenUpdating = False

Set pt = ActiveSheet.PivotTables("PivotTable1")
Set pf = pt.PivotFields("month")
strMon = ActiveSheet.Range("A30").Value

For Each pi In pf.PivotItems
pi.Visible = True
Next pi

pf.CurrentPage = strMon

For Each pi In pf.PivotItems
If pi.Month = strMon Then
pi.Visible = True
Else
pi.Visible = False
End If
Next pi

Application.ScreenUpdating = True

End Sub

cheers Ben

"Roger Govier" wrote:

Hi

Take a look at the GetPivotData function.
You can find more information on this and its application at Debra
Dalgleish's site
http://www.contextures.com/xlPivot06.html

--
Regards

Roger Govier


"bennyob" wrote in message
...
Hello
I would like to have a drop down list in a user form to select a
value, in
my case a month, that will select the matching value from the manual
filter
(on the column labels) or the report filter options in a pivot table.

Any help would be greatly appreciated
cheers ben

My pivot table looks a little like this:
Sum of TOTAL $ month DATE
January February
Category 12/01/2007 19/01/2007 20/01/2007 21/01/2007 2/02/2007
3/02/2007
Apartment rent 1500 1500
Assistant salary 580 580
Bank Commission 22 55
Car petrol 33 23.53





  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,979
Default user forms and pivot tables question

It would be easier to help if you mention what the error is, but you
could try setting the sort for the field to manual sort, instead of
automatic.

To manually change the setting, double-click on the field button, and
click Advanced. Under AutoSort, choose Ascending or Descending.

bennyob wrote:
Thanks for the link, not what I am looking for but I sure can use this
function elsewhere.

What I am trying looks like this, but I have a bug in the 'pi.Visible =
True" line:

Sub Macro1()
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Dim strMon As String

Application.ScreenUpdating = False

Set pt = ActiveSheet.PivotTables("PivotTable1")
Set pf = pt.PivotFields("month")
strMon = ActiveSheet.Range("A30").Value

For Each pi In pf.PivotItems
pi.Visible = True
Next pi

pf.CurrentPage = strMon

For Each pi In pf.PivotItems
If pi.Month = strMon Then
pi.Visible = True
Else
pi.Visible = False
End If
Next pi

Application.ScreenUpdating = True

End Sub

cheers Ben

"Roger Govier" wrote:


Hi

Take a look at the GetPivotData function.
You can find more information on this and its application at Debra
Dalgleish's site
http://www.contextures.com/xlPivot06.html

--
Regards

Roger Govier


"bennyob" wrote in message
...

Hello
I would like to have a drop down list in a user form to select a
value, in
my case a month, that will select the matching value from the manual
filter
(on the column labels) or the report filter options in a pivot table.

Any help would be greatly appreciated
cheers ben

My pivot table looks a little like this:
Sum of TOTAL $ month DATE
January February
Category 12/01/2007 19/01/2007 20/01/2007 21/01/2007 2/02/2007
3/02/2007
Apartment rent 1500 1500
Assistant salary 580 580
Bank Commission 22 55
Car petrol 33 23.53







--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default user forms and pivot tables question

It gives me:

Run-time error '1004':
Unable to set the Visible property of the PivotItem class

This is the code I would like for one application if I can get it to work,
however I would also live to have a drop down box in a user form to select an
item each from 2 different fields, using the items available from the pivot
table in the user form.

Incidently the contextures website is brilliant!

Cheers Ben

"Debra Dalgleish" wrote:

It would be easier to help if you mention what the error is, but you
could try setting the sort for the field to manual sort, instead of
automatic.

To manually change the setting, double-click on the field button, and
click Advanced. Under AutoSort, choose Ascending or Descending.

bennyob wrote:
Thanks for the link, not what I am looking for but I sure can use this
function elsewhere.

What I am trying looks like this, but I have a bug in the 'pi.Visible =
True" line:

Sub Macro1()
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Dim strMon As String

Application.ScreenUpdating = False

Set pt = ActiveSheet.PivotTables("PivotTable1")
Set pf = pt.PivotFields("month")
strMon = ActiveSheet.Range("A30").Value

For Each pi In pf.PivotItems
pi.Visible = True
Next pi

pf.CurrentPage = strMon

For Each pi In pf.PivotItems
If pi.Month = strMon Then
pi.Visible = True
Else
pi.Visible = False
End If
Next pi

Application.ScreenUpdating = True

End Sub

cheers Ben

"Roger Govier" wrote:


Hi

Take a look at the GetPivotData function.
You can find more information on this and its application at Debra
Dalgleish's site
http://www.contextures.com/xlPivot06.html

--
Regards

Roger Govier


"bennyob" wrote in message
...

Hello
I would like to have a drop down list in a user form to select a
value, in
my case a month, that will select the matching value from the manual
filter
(on the column labels) or the report filter options in a pivot table.

Any help would be greatly appreciated
cheers ben

My pivot table looks a little like this:
Sum of TOTAL $ month DATE
January February
Category 12/01/2007 19/01/2007 20/01/2007 21/01/2007 2/02/2007
3/02/2007
Apartment rent 1500 1500
Assistant salary 580 580
Bank Commission 22 55
Car petrol 33 23.53







--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,979
Default user forms and pivot tables question

Try setting the field to manual sort, as I suggested, and that should
fix the Visible property error.
Why are you creating a user form? Could you just let users select from
the pivot table's page fields?

Thanks for letting me know that you like the site. It has some sample
files that might give you ideas for your code:

http://www.contextures.com/excelfiles.html

Under PivotTables, look for 'PT0003 - Change Page Field' and 'PT0013 -
Filter From Worksheet Selection'

bennyob wrote:
It gives me:

Run-time error '1004':
Unable to set the Visible property of the PivotItem class

This is the code I would like for one application if I can get it to work,
however I would also live to have a drop down box in a user form to select an
item each from 2 different fields, using the items available from the pivot
table in the user form.

Incidently the contextures website is brilliant!

Cheers Ben

"Debra Dalgleish" wrote:


It would be easier to help if you mention what the error is, but you
could try setting the sort for the field to manual sort, instead of
automatic.

To manually change the setting, double-click on the field button, and
click Advanced. Under AutoSort, choose Ascending or Descending.

bennyob wrote:

Thanks for the link, not what I am looking for but I sure can use this
function elsewhere.

What I am trying looks like this, but I have a bug in the 'pi.Visible =
True" line:

Sub Macro1()
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Dim strMon As String

Application.ScreenUpdating = False

Set pt = ActiveSheet.PivotTables("PivotTable1")
Set pf = pt.PivotFields("month")
strMon = ActiveSheet.Range("A30").Value

For Each pi In pf.PivotItems
pi.Visible = True
Next pi

pf.CurrentPage = strMon

For Each pi In pf.PivotItems
If pi.Month = strMon Then
pi.Visible = True
Else
pi.Visible = False
End If
Next pi

Application.ScreenUpdating = True

End Sub

cheers Ben

"Roger Govier" wrote:



Hi

Take a look at the GetPivotData function.
You can find more information on this and its application at Debra
Dalgleish's site
http://www.contextures.com/xlPivot06.html

--
Regards

Roger Govier


"bennyob" wrote in message
...


Hello
I would like to have a drop down list in a user form to select a
value, in
my case a month, that will select the matching value from the manual
filter
(on the column labels) or the report filter options in a pivot table.

Any help would be greatly appreciated
cheers ben

My pivot table looks a little like this:
Sum of TOTAL $ month DATE
January February
Category 12/01/2007 19/01/2007 20/01/2007 21/01/2007 2/02/2007
3/02/2007
Apartment rent 1500 1500
Assistant salary 580 580
Bank Commission 22 55
Car petrol 33 23.53






--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html





--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

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
Further Question about Pivot Tables - Multiple Consolidation Range Florence Excel Discussion (Misc queries) 0 February 1st 07 10:00 AM
Excel 97 Question (Pivot tables) GJS Excel Discussion (Misc queries) 2 August 10th 06 01:57 PM
User Forms Runner77 Excel Discussion (Misc queries) 1 January 12th 06 06:20 AM
Pivot Tables - "simple" question Eoin Bairead Excel Discussion (Misc queries) 1 February 28th 05 07:07 PM
Question about Pivot Tables..why is that ~D~ Excel Discussion (Misc queries) 3 January 18th 05 07:36 AM


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