Intercepting Specific Alerts

ButtFace

Board Regular
Joined
Oct 16, 2015
Messages
60
Office Version
  1. 2010
Platform
  1. Windows
Hi All.

I have a workbook that extensively uses [worksheet scoped] named ranges (hundreds). When users copy data from one worksheet to another, Excel prompts the user to use existing instances of the range name or define new ones. While DisplayAlerts = False would suppress these messages, I don't want other alerts to be suppressed (e.g., merged cell alerts). Is there a way to intercept and suppress specific alerts? Something like err.Number but for alerts (e.g., alert.Number)? :confused:

TIA.
 

Some videos you may like

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

ButtFace

Board Regular
Joined
Oct 16, 2015
Messages
60
Office Version
  1. 2010
Platform
  1. Windows
Was hoping there was a way to target specific alerts instead of suppressing all, using your example video:

Code:
'some fake code to illustrate my point
on alert goto alerthandler
thisworkbook.worksheets.add
activesheet.delete
exit sub

alerthandler:
if alert.number = 8 then alert.clear 'some fake code
resume next
 

Watch MrExcel Video

Forum statistics

Threads
1,122,818
Messages
5,598,280
Members
414,223
Latest member
Accountant2B

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top