my macro is putting formulas into cells which refer to cells in other files.
DisplayAlerts = False is suppressing the alert for when a file doesn't exist and just skips it and gives a #REF error.
But if the file exists and the tab I'm looking for doesn't, it pops up with the list of tabs in that file (I want it to just cancel and act the same as though the file didn't exist).
Even if I put the "DisplayAlerts = False" immediately before the "cells(...).formula = ..." it still doesn't suppress it.
Any ideas?
Here's most of my code:
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
FileDirectory = Application.ActiveWorkbook.Path & "\"
y = 0
Range("A10").Select
Do While True
If Len(ActiveCell.Value) < 1 Then
Exit Do
Else
For i = 0 To 17
Cells(10 + y, 2 + i).Formula = _
"='" & FileDirectory & "[" & Cells(10 + y, 1).Value & ".xls]" & Cells(3, 2 + i).Value & "'!" & Cells(5, 2 + i).Value
Next i
End If
y = y + 1
Cells(10 + y, 1).Activate
Loop
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Bookmarks