suppress dialog boxes vba NOT applicatoin.displayalert = false

martingaleh

Board Regular
Joined
Jul 18, 2011
Messages
83
Here's my code:

Code:
aggregate = "'" & ThisWorkbook.Path & "\" & counter & "\[aggregator.xlsm]" & ws.Name & "'!percent"
            prior = "[" & counter & ".xlsm]" & ws.Name & "!" & counter & "MBO"
            If counter = qt Then
                rng.Formula = "=iferror(" & aggregate & ",""oddly the tab is missing"")"
            Else
                rng.Formula = "=iferror(" & prior & "," & aggregate & ")"
            End If

since it's designed to fail out, inevitably one of the links will be missing. Excel will then have this annoying dialog box that asks for a new link because the link is missing. I tried
application.displayalerts = false
and
application.enableevents = false

They both don't work. Is there another one?
 
INDIRECT will work with sheets on other workbooks, just not if the other workbook is closed.

It sounds like you have a Master workbook, that contains formulas that you want to refer to another workbook, when that workbook is opened.
The problem is that formulas have to refer to real worksheets in real workbooks, not hypothetical future sheets.

You could have the Master workbook use the Application level Workbook_Open event to detect when a new workbook is opened. Then, if that workbook is suitable, set all the formulas to have cells on that workbook be precedents.

Alternately, you could create a UserForm that would look to the avaiable (closed) workbooks and when you select one, open that workbook and write the formulas.

If you have lots of cells with formulas, but these many formulas refer to only a few ranges in the other book, changing Name definitions might be better than setting each cell's formula.
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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