ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting pivot table field (current page) to a chosen value (https://www.excelbanter.com/excel-programming/306034-setting-pivot-table-field-current-page-chosen-value.html)

Grant[_5_]

Setting pivot table field (current page) to a chosen value
 
Hello,

I have the following code:

ActiveSheet.PivotTables("PvtVarianceRpt2").PivotFi elds
("Line").CurrentPage = cboLine.Name

Where cboLine is a combo drop down list.

It keeps asking for "Object required"

How might I go around fixing this?

Thanks in advance for the replies,
Grant.

Debra Dalgleish

Setting pivot table field (current page) to a chosen value
 
For a combobox from the Control toolbox:

Dim str As String
str = ActiveSheet.OLEObjects("cboLine").Object.Value

ActiveSheet.PivotTables("PvtVarianceRpt2") _
.PivotFields("Line").CurrentPage = str

Grant wrote:
I have the following code:

ActiveSheet.PivotTables("PvtVarianceRpt2").PivotFi elds
("Line").CurrentPage = cboLine.Name

Where cboLine is a combo drop down list.

It keeps asking for "Object required"


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



All times are GMT +1. The time now is 05:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com