NormChart55
New Member
- Joined
- Feb 22, 2022
- Messages
- 44
- Office Version
- 2016
- Platform
- Windows
Hello All,
I am working at getting messages included in some templates to clean up any errors that may occur and help the user. I have this which is providing the message prompt, however it does it even if the SKU is available and there is no error? basically this is copying and pasting a SKU into a pivot and sometimes they may have already had it filtered incorrectly to where the SKU number is not in the pivot. I am getting the message box in all scenarios. I am sure I have something slightly off. Thoughts?
I am working at getting messages included in some templates to clean up any errors that may occur and help the user. I have this which is providing the message prompt, however it does it even if the SKU is available and there is no error? basically this is copying and pasting a SKU into a pivot and sometimes they may have already had it filtered incorrectly to where the SKU number is not in the pivot. I am getting the message box in all scenarios. I am sure I have something slightly off. Thoughts?
VBA Code:
Dim a As String
Dim pt As PivotTable
ThisWorkbook.Worksheets("Template").Activate
a = Worksheets("Template").Cells(668, 4).Value
On Error Resume Next
For Each pt In ActiveSheet.PivotTables
With pt.PivotFields("SKU")
.ClearAllFilters
.CurrentPage = a
End With
Next
MsgBox "SKU Not available in the Pivot. Check if you selected the SKU correctly and if any items are already filtered out of the pivot. If the device is new, make sure its included in the source data.", vbCritical