Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

There's already data in [SheetName][PivotTableName]". Do you want to replace it?

Tags:

excel

vba

I am working with an Excel 2016 template with pivot tables, pivot charts, and a dashboard where I am dynamically updating data depending on various selections and filters. Whenever I open up a new version of the report (Excel file) I get the following message for each chart:

There's already data in [SheetName][PivotTableName]". Do you want to replace it?

I have browsed the internet and I have found 2 different solutions that have not worked.

  1. I tried to create a Macro that disabled messages and then refreshed all data. I used the following bit of VBA code to disables messages but it did not work as expected:

    Applictaion.DisplayAlerts = false
    
  2. I went into the advanced options of Excel I tried to disable the setting for "Alert before overwriting cells". This did not solve my issues and I asked a coworker to try on his machine as well and he too got the same message.

Does anyone know how to disable this message from popping up?

like image 651
zagasi Avatar asked Oct 30 '22 14:10

zagasi


1 Answers

In addition for your first solution:

  1. Use before the code that pop's the warning:

Application.DisplayAlerts = False

  1. After the code is finished, enable the alrert mode again:

Application.DisplayAlerts = True

like image 161
Felipe Ribeiro Avatar answered Nov 15 '22 05:11

Felipe Ribeiro