ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Forcing a function to calculate (https://www.excelbanter.com/excel-programming/324078-forcing-function-calculate.html)

Floyd[_2_]

Forcing a function to calculate
 
What is the syntax to force a function to calculate from another sheet?

Function Test()

End Function

Worksheets("Sheet1").Test.Calculate

This won't work, but I think I am getting close.

Thanks in advance.

Floyd


Tom Ogilvy

Forcing a function to calculate
 
Worksheets("Sheet1").Calculate

If you want to force an individual cell to calculate and Excel doesn't think
it needs to be calculatee

With worksheets("Sheet1").Range("B9")
.Formula = .Formula
End with

would be one way if the formula is in B9 of sheet1.

--
Regards,
Tom Ogilvy

"Floyd" wrote in message
oups.com...
What is the syntax to force a function to calculate from another sheet?

Function Test()

End Function

Worksheets("Sheet1").Test.Calculate

This won't work, but I think I am getting close.

Thanks in advance.

Floyd




Ben

Forcing a function to calculate
 
are you talking about you want to calculate that worksheet or you want to run
that function from VBA?
ben

"Floyd" wrote:

What is the syntax to force a function to calculate from another sheet?

Function Test()

End Function

Worksheets("Sheet1").Test.Calculate

This won't work, but I think I am getting close.

Thanks in advance.

Floyd



Fredrik Wahlgren

Forcing a function to calculate
 

"Floyd" wrote in message
oups.com...
What is the syntax to force a function to calculate from another sheet?

Function Test()

End Function

Worksheets("Sheet1").Test.Calculate

This won't work, but I think I am getting close.

Thanks in advance.

Floyd



Test is a user defined function, right? You only need to add one line of
code to the function, like this:

Function Test()
Application.Volatile True
End function

"Test" will now be recalculated whenever the sheet is reaclculated.

/Fredrik




Floyd[_2_]

Forcing a function to calculate
 
All:

I have never seen anything like this.

I have all of the following commands in the function:
Application.Volatile True
Application.Calculate
Application.Calculation = xlCalculationAutomatic

I have verified that the function will compile and that
Tools-Options-Calculation-Automatic is setup.

I have tried the code segment suggested by Mr. Ogilvy in this post and
still none of this works.

The only thing that works is to open Sheet1 and hit F9. Only then will
it calculate the function.

I spent the weekend reading/searching this group's archives. Although
I found quite a bit of interesting material, I did not find a solution.

Could this be a bug in Excel?



All times are GMT +1. The time now is 02:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com