cogswel__cogs
Board Regular
- Joined
- Jan 3, 2018
- Messages
- 181
Hi,
I want to se a variable to switch value of pivot field. I recorded a macro and was going to incorporate it into my own code.
But I think I need to do add quotes. How do I add the quotes so the macro will not fail at line 4?
Sub Macro2()
Dim b As String
b = 1003173578
With ActiveSheet.PivotTables("PivotTable5").PivotFields("Billing Provider NPI")
.PivotItems(b).Visible = True
End With
' With ActiveSheet.PivotTables("PivotTable5").PivotFields("Billing Provider NPI")
' .PivotItems("1003173758").Visible = False
' End With
Range("I26").Select
End Sub
I want to se a variable to switch value of pivot field. I recorded a macro and was going to incorporate it into my own code.
But I think I need to do add quotes. How do I add the quotes so the macro will not fail at line 4?
Sub Macro2()
Dim b As String
b = 1003173578
With ActiveSheet.PivotTables("PivotTable5").PivotFields("Billing Provider NPI")
.PivotItems(b).Visible = True
End With
' With ActiveSheet.PivotTables("PivotTable5").PivotFields("Billing Provider NPI")
' .PivotItems("1003173758").Visible = False
' End With
Range("I26").Select
End Sub