The use of "Calculate"

Skippy

Board Regular
Joined
Mar 3, 2002
Messages
194
A couple of quick questions:

1. If I have two workbooks open, both with "Sheet1", would WorkSheets(1).Calculate only affect the Workbook I am currently working on? If not, is there a way to get around this?

2. What if a Workbook has more than 1 sheet to update - do I have to specify each separate worksheet as in the first example?

Thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
On 2002-03-04 07:05, Skippy wrote:
A couple of quick questions:

1. If I have two workbooks open, both with "Sheet1", would WorkSheets(1).Calculate only affect the Workbook I am currently working on? If not, is there a way to get around this?

2. What if a Workbook has more than 1 sheet to update - do I have to specify each separate worksheet as in the first example?

Thanks

1. It would only calculate the first worksheet in the active workbook (note, the first workbook might not necessarily be named "Sheet1").

2. If you only want to calculate all sheets in that specific workbook, then you will have to calc each worksheet separately. Something like:
Code:
Dim ws As Worksheet
For Each ws In ActiveWorkbook
    ws.Calculate
Next ws

Regards,
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,726
Members
448,987
Latest member
marion_davis

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