Calculate Specific (Contiguous) Cells Only

velohead

Board Regular
Joined
Aug 22, 2007
Messages
212
I'm working on a huge spreadsheet, that I inherited from a previous incumbant.

I would like to re-calculate (ie F9) just 12 specific contiguous cells which are monthly totals, from a manual data input area.

Calculating 'just' the worksheet on which they reside would take too long, let alone the entire workbook !
Hence, just want to recalc those 12 cells.

Is there any VB code whereby......
a) I select the contiguous area by hand (i can write that bit)
b) press icon button, and the highlighted selection recalculates.

As implied, a VB solution is ideal.
Thx.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi

After setting your calculation mode to manual, use the following code (you can assign it to a button too)

Sub CalculateSpecificCells()
Sheets("XYZ").Range("A1:A10,B25,C30,D15:20").Calculate
End Sub

Change the sheet name and ranges to suit your data.

Contiguous ranges can be written as, for example, A1:A10.... you can specify non-contiguous ranges by separating it with a comma. Note that all should be included within the "".

Hope this helps.
 
Upvote 0
Thanks Sandeep, that looks like exactly what I need.

I'll try this out once I can get my head above the water (very busy at work, too busy infact).

Thanks Again
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,879
Members
452,948
Latest member
Dupuhini

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