+ Reply to Thread
Results 1 to 1 of 1

Thread: Pivot update on combobox change.

  1. #1
    Registered User
    Join Date
    07-13-2011
    Location
    Finland
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question Pivot update on combobox change.

    I'm trying to do two comboboxes that are used to change pivot table fields.

    Private Sub ComboBox1_Change()
    
        Dim pt As PivotTable
        Dim pf As PivotField
        Dim cb As ComboBox
        
        Set pt = Sheets("SELECTION").PivotTables("PivotTable2")
        Set pf = pt.PivotFields("FY")
        Set cb = RemoteControl.ComboBox1
        
        pf.CurrentPage = cb.Value
        
    End Sub
    
    Private Sub ComboBox2_Change()
    
        Dim pt As PivotTable
        Dim pf As PivotField
        Dim cb As ComboBox
        
        Set pt = Sheets("SELECTION").PivotTables("PivotTable2")
        Set pf = pt.PivotFields("Select Actuality")
        Set cb = RemoteControl.ComboBox2
        
        pf.CurrentPage = cb.Value
    
    End Sub
    And here are the variables for the comboxes:

        With RemoteControl.ComboBox2
        
        .AddItem "AF"
        .AddItem "GF"
        .AddItem "F1"
        .AddItem "F2"
        .AddItem "F3"
        .AddItem "F4"
        .AddItem "F5"
        .AddItem "F6"
       
        End With
        
        With RemoteControl.ComboBox1
        
        .AddItem "2010"
        .AddItem "2011"
        .AddItem "2012"
        
        End With
    The problem is that if choose value 2010 or 2011 in combobox1, i get an error "Run-time error 5: Invalid procedure call or argument". Strange thing is that combobox2 is working perfectly, and combobox1 is working if i select value 2012.

    I'm totally confused and have searched for the answer all over, so I would really appreciate if someone could help me!

    Br,
    Teemu
    Last edited by Teemu; 07-13-2011 at 01:51 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0