Hi @Johns, Lewis
Welcome to the Microsoft Q&A Forum.
Based on the information you’ve provided, it seems the macro code itself may still be valid. However, the error you're encountering, "Run-time error 1004: The PivotTable field name is not valid", is commonly caused by issues in the source data. Please review the structure of your data, such as:
- Missing or blank column headers.
- Merged cells in the header row.
- Field names in the macro not matching the actual column headers in the data.
At this time, there is no official confirmation from Microsoft that the Windows Security Patch released on June 23, 2025, directly causes this issue. However, I also found a related issue in the Microsoft Community that appears to be caused by recent Excel updates. While it's not exactly the same as yours, you might find it helpful to read through: Run-time Error 1004 "The PivotTable filed name is not valid..." - Microsoft Community
If the issue persists after checking the data structure, feel free to share more details or a sample of your workbook, and I’d be happy to assist further. I'm looking forward to your update.
If the answer is partially helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.