EVALUATE function crashing

louiserace

New Member
Joined
Jun 24, 2015
Messages
15
I have a couple of macros that have been running weekly for over 2 years. However, the first time they have been run this year the EVALUATE line crashes in the following piece of code:

VBA Code:
    Dim deleteStudent As Boolean
    deleteStudent = Evaluate("IsError('Student Data'!1:1)")
    If deleteStudent = False Then
        Application.DisplayAlerts = False
        Worksheets("Student Data").Delete
        Application.DisplayAlerts = True
    End If
with the error:

Run-time error '13':
Type mismatch

I have tried old versions of the spreadsheets that ran perfectly last year and they crash as well.

What can have changed?

By the way, I know that the method I used is not the best way, but I had not been coding long and I would definitely do it another way now but I would still like to know why it has suddenly stopped working.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
What version of Xl are you running?
 
Upvote 0
It is crashing on Excel 365 and it worked fine on Excel 2016. I have only just found out that the Excel version has been upgraded for the users. Does EVALUATE not work in Excel 365?
 
Upvote 0
Do you have Dynamic Arrays.
If your not sure try typing =seq into a cell, does it suggest the function SEQUENCE?
 
Upvote 0
I think that's what's causing the problems, as it now tries to spill the formula, try this instead
VBA Code:
   Dim deleteStudent As Boolean
   deleteStudent = Evaluate("Isref('Student Data'!A1)")
   If deleteStudent = True Then
 
Upvote 0
Solution
Thanks

It worked perfectly but also using IsError and replacing the 1:1 with A1 worked.

Thanks for solving the mystery.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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