I want to get a name from user input in inputbox, and then use that name throughout my code in place of [Table2]. See below for sample. I have searched for an answer for a long time. Please Help.
Code:
Set ws = Worksheets.AddSet pc = ActiveWorkbook.PivotCaches.Create(xlExternal, ActiveWorkbook.Connections("ThisWorkbookDataModel"), 6)
Set pt = pc.CreatePivotTable(ws.Range("A1"), "FSBH_Regular_Units")
With pt
With ActiveSheet.PivotTables("FSBH_Regular_Units").CubeFields("[Table2].[Staff]")
.Orientation = xlRowField
.Position = 1
End With