-
Automatic Calculation when sheet tab clicked
Hi All. I have a excel spreadsheet with certain marcos built in. I need a method to automatically calculate the sheet.
Such as;
Activesheet.CalculateFull
or an alternative to Ctrl +alt + F9
Ideally I would live to activate it when the user navigates using the sheet tabs in excel, so when the user clicks page 5 tab for example that sheet calculates. I could create buttons to go to next page/previous pages that trigger the calculation but ideally want it to go through users clicking on the excel sheet tabs. Can this be done by inserting a new module into the VBA?
Thank you for reading!
-
Welcome to the forum!
In ThisWorkbook object:
[VBA]Private Sub Workbook_Open()
ActiveSheet.Calculate
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Sh.Calculate
End Sub
[/VBA]
-
Thanks Kenneth. I'm afriad the code doesn't work for my case! Is there anything stronger than the .calculate method. Crtl alt F9 works. is there a calculateRebuild or something similar?
-
if a create a button
Application.CalculateFull
works; however I tried to fit this into your code, and it still won't automatically update when i open the page. Instead it works if i click on a cell and push enter
Private Sub Workbook_Open()
Application.CalculateFull
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.CalculateFull
End Sub
Sorry I am a complete newbie at this!!!
-
In the VBE, did you doubleclick ThisWorkbook and paste the workbook code that you last posted in that object?
-
Yes, double clicked the thisworkbook object and inserted the code!
-
Post a short example workbook and tell us how it needs to work if you like.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules