Changing Data Source of Pivot table

Hi,
I am trying to change the data source for my pivot tables via UiPath but cannot type into the field properly. Everytime I try to type into the field, it adds the range I want to type at the end even though I have empty field marked.
This is the window I am referring to.
image

Hi @anon5199880,

Did you get any solution for this?

@vinnu.vanga
What I did was use the send hotkey activity to delete the text that is already within the source and then I used the type into activity.

I tried the same but didn’t work for me. I got VBA which works perfectly fine.

Hi Can you share the VBA code to update the Pivot table data source range
Thank you in advance

Sub Change_Pivot_Source()

    Dim pt As PivotTable

    For Each pt In ActiveWorkbook.Worksheets("Sheet2").PivotTables
             pt.ChangePivotCache ActiveWorkbook.PivotCaches.Create _
                (SourceType:=xlDatabase, SourceData:="Data2")
    Next pt

End Sub

Try above code

1 Like

Thank you Vinod
Let me try

I will update the result

Thank you

Hi Vinod
What to give My data source range

‘Source worksheet name’! A3:K234

Is this correct?

Please suggest

Thank you in ad

Exactly and let me know the result.