I have an Excel sheet with a user form that requests an entry from the user. The input is then assigned to a cell in the worksheet which serves as a parameter for my external query, which in turn, is the source of my pivot table. Everything is fine except that when I refresh my pivot table (through code), it does not do it. Here is my code:
Private Sub CommandButton1_Click()
Range("D2").Select
ActiveCell.Value = txtAccount.Value
Range("A9").Select
ActiveSheet.PivotTables("PivotTable2").PivotCache.Refresh
Unload Me
End Sub
I assign the user-input to cell D2 which serves as the parameter for my query. If I don't run the first two lines (which means I simply am refreshing the pivot), the pt refreshes. However, when I run the entire routine, pt does not refresh. How do I code it to refresh the pt?
Happy Valentine to all.
Private Sub CommandButton1_Click()
Range("D2").Select
ActiveCell.Value = txtAccount.Value
Range("A9").Select
ActiveSheet.PivotTables("PivotTable2").PivotCache.Refresh
Unload Me
End Sub
I assign the user-input to cell D2 which serves as the parameter for my query. If I don't run the first two lines (which means I simply am refreshing the pivot), the pt refreshes. However, when I run the entire routine, pt does not refresh. How do I code it to refresh the pt?
Happy Valentine to all.