Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Re calculate

Hiya

I have a spreadsheet which is used a lot and often left
open over night. Several cells include =Today() to
generate various dates.
The problem is that unless the sheet is closed and re-
opened each day, the day doesn't change.

Is there any way I can get the sheet to re-calculate every
time the workbook is activated.
I've tried the following but without success.
Sub Workbook_Activate
sheet1.calculate
end sub

thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Re calculate

Hi,
In the workbook that you want to recalculate, place the
following code in the object module of ThisWorkbook

Option Explicit

Dim MyxlApp As New clsMyxlAppEvents

Private Sub Workbook_Open()
Set MyxlApp.xlApp = Application
End Sub

The create a class module call clsMyxlAppEvents and place
the following code in the new module,

Private Sub xlApp_WorkbookActivate(ByVal Wb As
Excel.Workbook)

if wb.name = "My Workbook.xls" then
application.activeworkbook.sheets("sheet1").calcul ate


end sub

You can add additional code so that it only runs once per
day e.g add one date variable that records when the last
calculate was done.

Hope this helps
regards
KM




-----Original Message-----
Hiya

I have a spreadsheet which is used a lot and often left
open over night. Several cells include =Today() to
generate various dates.
The problem is that unless the sheet is closed and re-
opened each day, the day doesn't change.

Is there any way I can get the sheet to re-calculate

every
time the workbook is activated.
I've tried the following but without success.
Sub Workbook_Activate
sheet1.calculate
end sub

thanks
.

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
calculate time does not calculate Wanna Learn Excel Discussion (Misc queries) 4 August 19th 08 12:51 AM
How do I calculate? Tammy Excel Discussion (Misc queries) 5 December 18th 06 11:00 AM
calculate APR on ARM John McHugh Excel Worksheet Functions 1 May 14th 05 07:56 AM
Not able to calculate. mark_kramarczyk Excel Worksheet Functions 1 December 29th 04 08:55 PM
Macro that hide or unhide and not calculate or calculate Jonsson Excel Programming 1 August 19th 03 04:22 PM


All times are GMT +1. The time now is 10:40 AM.

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

About Us

"It's about Microsoft Excel"