ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Recalculation on cell changes fails when using VBA function (https://www.excelbanter.com/excel-programming/300983-recalculation-cell-changes-fails-when-using-vba-function.html)

wmauss

Recalculation on cell changes fails when using VBA function
 
Folks,

I have found several threads on very similar issues but the suggestion
did not work for me.

I am using a VBA function in a spread sheet. However, when I change
value in the sheet, Excel does no recalculation for the VBA function
It does recalculate only the cells that contain Excel functions.

It doesn't even recalculate the VBA function after pressing ALT+CTRL+F
as I read in another thread.

Also, putting in the respective worksheet code
Private Sub Worksheet_Change(ByVal Target As Range)
Calculate
End Sub

did not help.
Same for application.volatile and application.calculate which
inserted as first line in the function's body or in main() or in th
above Private Sub.

Any ideas how I can get Excel to recalculate the function upon valu
changes in the spreadsheet??

Werne

--
Message posted from http://www.ExcelForum.com


Frank Kabel

Recalculation on cell changes fails when using VBA function
 
Hi
you may post your macro :-)
But adding the line
application.volatile
should work

or adding the used cells as parameters for your function should also do
the trick


--
Regards
Frank Kabel
Frankfurt, Germany


Folks,

I have found several threads on very similar issues but the
suggestions did not work for me.

I am using a VBA function in a spread sheet. However, when I change a
value in the sheet, Excel does no recalculation for the VBA function.
It does recalculate only the cells that contain Excel functions.

It doesn't even recalculate the VBA function after pressing
ALT+CTRL+F9 as I read in another thread.

Also, putting in the respective worksheet code
Private Sub Worksheet_Change(ByVal Target As Range)
Calculate
End Sub

did not help.
Same for application.volatile and application.calculate which I
inserted as first line in the function's body or in main() or in the
above Private Sub.

Any ideas how I can get Excel to recalculate the function upon value
changes in the spreadsheet??

Werner


---
Message posted from http://www.ExcelForum.com/



wmauss[_2_]

Recalculation on cell changes fails when using VBA function
 
Hi Frank,

indeed, when I tried it again this morning it worked.
I may add the function anyway later on, it is not on this PC. It simpl
does what I call "conditional sum", summing a column of number
depending on two criterias (rather than just one as in sumif).

Thanks for your help!

Greetings

Thoma

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 03:05 AM.

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