pType = Sheet1.Cells(25,"B") If pType = "(Multiple Items)" Then Dim pt As PivotTable Dim payTypeField As PivotField Dim items As Variant Dim Hitems As Variant Dim str As String Dim ptables As PivotTable Set pt = Sheet1.PivotTables("PivotTable3") pType = "" Set payTypeField = pt.PivotFields("[DimPayment].[Payment-TypeName]") For Each items In payTypeField.VisibleItemsList pType = pType + Replace(Mid(CStr(items), InStr(CStr(items), "&") + 2), "]",",") Next items pType = Mid(pType, 1, Len(pType) - 1) End If pType = "'"& pType & "'"
pType = Sheet1.Cells(25,"B")
pType = Sheet1.Cells(25,2) 'or 'pType = Sheet1.Range("B25")
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)