S Oberlander
Board Regular
- Joined
- Nov 25, 2020
- Messages
- 153
- Office Version
- 365
- Platform
- Windows
I have this procedure for showing details on a pivot table where a button is added and a macro is assigned to it on the new page.
It always works fine the first time and the button does what it needs to.
But when being used again on the same workbook, it seems to work fine, however when the button is clicked there is popup saying it can't access the file [containing the macro].
The weird part here is that the path listed on the popup is distorted from what is in the macro.
Note I initially tried doing this in a
Here is a screenshot of the popup and the code below it.
It always works fine the first time and the button does what it needs to.
But when being used again on the same workbook, it seems to work fine, however when the button is clicked there is popup saying it can't access the file [containing the macro].
The weird part here is that the path listed on the popup is distorted from what is in the macro.
Note I initially tried doing this in a
Private Sub Workbook_SheetBeforeDoubleClick
which gave me the same issue.Here is a screenshot of the popup and the code below it.
VBA Code:
Sub drillpivot()
On Error GoTo ex 'if the selected cell is not a value of the pivot table it will not and is not supposed to work
Selection.ShowDetail = True 'this automatically adds a new sheet with the details of the selected value and activates the new sheet
Range("K:K,M:N,E:E,O:Y").EntireColumn.Hidden = True
ActiveSheet.Buttons.Add(937.5, 23.25, 114.75, 27).Select
Selection.OnAction = "R:\Macro Data\RP Macro Wrkbk!refreshT"
Selection.Characters.Text = "Refresh Table"
Range("A1").Select
ex:
End Sub