• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro Button on Rectangle Shape

Dear all,

Please help me in shape button script. I have script in VB button it available in the developer TAB. but same script not woking in the Rectangular Shape Button from insert tab please help.

Note : if we click button sheet 3 pivot is getting filter.

Code:
Sub Button_Click()
  With ThisWorkbook.Worksheets("Sheet3")
  .PivotTables(1).PivotFields("State").ClearAllFilters
  .PivotTables(1).PivotFields("State").CurrentPage = ThisWorkbook.Worksheets("Sheet2").Buttons(Application.Caller).Caption
  End With
End Sub
 
Hi,

Try below code.

Code:
Sub Rectangle2_Click()
    With ThisWorkbook.Worksheets("Sheet3")
        .PivotTables(1).PivotFields("State").ClearAllFilters
       
        .PivotTables(1).PivotFields("State").CurrentPage = ThisWorkbook.Worksheets("Sheet2").Shapes(1).TextFrame.Characters.Text
    End With
End Sub

Regards,
 
Back
Top