Intermittent error 2029

AnneW

New Member
Joined
Oct 19, 2005
Messages
7
Hello!

I have an error that pops up intermittently with seemingly no cause. The code that triggers it is here (the last line is the actual trigger):

Code:
Public Sub TestA1()

On Error GoTo Err_TestA1

    'only one fatal error is possible
    Debug.Print [A1_Period]
    If [A1_Period] <> 1 Then

The Debug.Print gives me "Error 2029" for the value of [A1_Period]. When the code is running, the error message that pops up is number 13 Type mismatch. The confusing thing is, [A1_Period] refers to a cell that has not changed in value, but sometimes this error happens and sometimes it does not. The cell contains a formula: =COUNTIF(E15:E17,TRUE). The calculation is working just fine. Anyone know why this error happens sometimes but not others? Thanks!

Edited to add: By the way, if I execute the code again after it bombs, without making any changes, it works fine. ????
 
Last edited:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Does it help if you use:

Code:
If Application.Range("A1_Period").Value <> 1 Then

instead of the evaluation?
 
Upvote 0
I did have another workbook open while I was working on this one, so thanks, I will try keeping to just one open at a time.
 
Upvote 0
Thank you, if the advice below doesn't work out I will try this version of the code.
 
Upvote 0
Thanks again for that help, I think this was the answer. The error has only happened while I had another workbook open. I appreciate the help!
 
Upvote 0

Forum statistics

Threads
1,215,903
Messages
6,127,652
Members
449,395
Latest member
Perdi

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