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

G

Grant

Hello,

I have the following code:

ActiveSheet.PivotTables("PvtVarianceRpt2").PivotFields
("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.
 
D

Debra Dalgleish

For a combobox from the Control toolbox:

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

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