![]() |
Calculate Selected cells only.
Hi All,
I am not sure if this is the right forum for a VBA question, but I did not find a more suitable one. I have a large workbook that takes a very long time to re-calculate so I am forced to turn off auto calc while working. However I need to re-calc some specific cells every time I update their formulas. I have an XLA addin automatically load that has a sub for calculating ONLY the selected cells withough re-calc-ing the whole nine yards. Sub CalcSelected() Selection.Calculate End Sub I am getting errors, I even get an error if I move the sub into a module in the very spreadsheet I am working on. Does anyone know how to do this correctly? Thanks in advance! Stan |
Calculate Selected cells only.
Try this...........
Sub ConditionalRecalc() With Selection ..Calculate End With End Sub Vaya con Dios, Chuck, CABGx3 "Stan" wrote: Hi All, I am not sure if this is the right forum for a VBA question, but I did not find a more suitable one. I have a large workbook that takes a very long time to re-calculate so I am forced to turn off auto calc while working. However I need to re-calc some specific cells every time I update their formulas. I have an XLA addin automatically load that has a sub for calculating ONLY the selected cells withough re-calc-ing the whole nine yards. Sub CalcSelected() Selection.Calculate End Sub I am getting errors, I even get an error if I move the sub into a module in the very spreadsheet I am working on. Does anyone know how to do this correctly? Thanks in advance! Stan |
Calculate Selected cells only.
Chuck,
Thank you for your reply. I get an error when trying to execute your sub: Run-time error '1004': Calculate method of Range class failed When I hit Debug the ..calculate line is highlighted. This is the same error as before. I am fairly new to VBA and probably doing something silly - but for the life of me can not figure out what it is. Thanks again! Stan "CLR" wrote: Try this........... Sub ConditionalRecalc() With Selection .Calculate End With End Sub Vaya con Dios, Chuck, CABGx3 "Stan" wrote: Hi All, I am not sure if this is the right forum for a VBA question, but I did not find a more suitable one. I have a large workbook that takes a very long time to re-calculate so I am forced to turn off auto calc while working. However I need to re-calc some specific cells every time I update their formulas. I have an XLA addin automatically load that has a sub for calculating ONLY the selected cells withough re-calc-ing the whole nine yards. Sub CalcSelected() Selection.Calculate End Sub I am getting errors, I even get an error if I move the sub into a module in the very spreadsheet I am working on. Does anyone know how to do this correctly? Thanks in advance! Stan |
Calculate Selected cells only.
I dunno, it seems to work ok in my Excel 97. I can even use this variation,
having pre-named a non-contiguious range of cells "MyRange" Sub ConditionalRecalcOLD() Dim MyRange As Range Range("MyRange").Calculate End Sub I can only think that if you're using a newer version of Excel, something might have changed........ Maybe someone else here or in the Programming newsgroup might be familiar with the problem. Vaya con Dios, Chuck, CABGx3 "Stan" wrote: Chuck, Thank you for your reply. I get an error when trying to execute your sub: Run-time error '1004': Calculate method of Range class failed When I hit Debug the .calculate line is highlighted. This is the same error as before. I am fairly new to VBA and probably doing something silly - but for the life of me can not figure out what it is. Thanks again! Stan "CLR" wrote: Try this........... Sub ConditionalRecalc() With Selection .Calculate End With End Sub Vaya con Dios, Chuck, CABGx3 "Stan" wrote: Hi All, I am not sure if this is the right forum for a VBA question, but I did not find a more suitable one. I have a large workbook that takes a very long time to re-calculate so I am forced to turn off auto calc while working. However I need to re-calc some specific cells every time I update their formulas. I have an XLA addin automatically load that has a sub for calculating ONLY the selected cells withough re-calc-ing the whole nine yards. Sub CalcSelected() Selection.Calculate End Sub I am getting errors, I even get an error if I move the sub into a module in the very spreadsheet I am working on. Does anyone know how to do this correctly? Thanks in advance! Stan |
All times are GMT +1. The time now is 10:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com