Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 150
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 150
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cells are selected but aren't displayed as selected Nifty Excel Discussion (Misc queries) 2 September 17th 06 07:22 PM
Cells are selected but aren't displayed as selected Nifty Excel Worksheet Functions 0 September 17th 06 11:34 AM
Calculate Based on Drop Down Item Selected JenB Excel Worksheet Functions 1 August 18th 06 05:42 PM
A validated List which link to selected cells according to what is selected on the list WL Excel Worksheet Functions 1 June 5th 06 08:52 PM
selected cells Juco Excel Worksheet Functions 1 February 13th 05 12:43 PM


All times are GMT +1. The time now is 06:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"