Calculate Method of Range Class Failed

Ken Puls

Active Member
Joined
Jun 9, 2003
Messages
484
Hello,

I'm having some issues with a subroutine that I'm working with. I've tried searching the board, but haven't come across anything.

I have an add-in with the following procedure called from my right click menu:

Code:
Public Sub Calculation_Recalc_Selection()
    Selection.Calculate
End Sub

The problem is that when I try to use it, I get a:
Run Time Error '1004'
Calculate Method of Range Class Failed

I actually had this right in the file, but changed it to an add-in as I need to share it with other people who usual manual calcuation all the time. It worked yesterday just fine, but not in the add-in version. I do know that it's calling the add-in though, as hitting debug does take me to this routine.

Other factors:
-Retruns error on protected or unprotected ranges
-Have unprotected all sheets, saved the file, and restarted Excel, but still the same issue.
-A reference is set in the file to the add-in
-Using Excel XP(2002) on Win XP

Can anyone help me out with this?

Thanks,
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Also, FYI:

Application.calculate runs without a problem
Activesheet.calculate also runs without issue

It is anything "range" driven that errors out.
 
Upvote 0
Perhaps:

Public Sub Calculation_Recalc_Selection()
ActiveWindow.Selection.Calculate
End Sub
 
Upvote 0
Hello,

Unfortunately no. Same errror.

What's weird is that the trigger point is going to manual calculation mode. In automatic calculation mode, it will work. Switching to manual makes it error out. :banghead:

Kind of sad, since the entire point is having it for manual mode.

I'm wondering if it could be the fact that it is contained in the add-in and not native in the sheet...

EDIT: Even after uninstalling the add-in, restarting excel and flipping to manual, the selection.calculation gives the error. This is very frustrating!
 
Upvote 0
Hi Ken,

Can you do something like...

Code:
With Application
    .Selection.Calculate
End With
 
Upvote 0
Hi firefytr,

Nope. No go there either. Even copying an example from the Calculate Method in the VBA help doesn't work! Now that's weird!
 
Upvote 0
Hi JPG,

Thanks for the links. I actually was pulling up the MSKB right when I got your email notification.

I am curious to know, though... if I turn off the iterations, will that cause a problem if I have 1500 formulas, many which are pulled from other formulas?

I also tried the other example that Jim Rech provided, but can't figure out how to coerce "selection" into a valid range to pass to the sub.
 
Upvote 0
Got it! :-D

I needed to insert the call word to call the CalcRange macro. :roll:

All good now!

Thanks a ton! :beerchug:
 
Upvote 0

Forum statistics

Threads
1,225,294
Messages
6,184,118
Members
453,214
Latest member
map_ninja

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