Intercepting Specific Alerts

ButtFace

Board Regular
Joined
Oct 16, 2015
Messages
63
Office Version
  1. 2016
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.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
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
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

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
Back
Top