i have a workbook with 3 sheets which hold the results of different calculations, each sheet is calculated before going to the next sheet (this works fine as individual parts of the macro),.
on the macro finishing only the last sheet shows the calculation has been updated( the sub totals are shown as calculating at the base of the screen) and the sheet show that it is ready for printing.
how can i stop the other two sheets from being over written with the end calculation
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
calculation working overtime (excel 2002)
Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » calculation working overtime (excel 2002)
- This topic has 10 replies, 3 voices, and was last updated 21 years, 11 months ago.
AuthorTopicWSalexanderd
AskWoody LoungerJuly 17, 2003 at 7:10 pm #390623Viewing 0 reply threadsAuthorReplies-
WSJohnBF
AskWoody LoungerJuly 17, 2003 at 8:26 pm #694550Hi. Your explanation doesn’t fit the problem. Can you explain why the first sheets are overwritten? Does the macro act on multiple sheets at the same time? Are you saying that after the macro has run, the “calculate” notification shows in the status bar? If so, you may want one of your last commands in the macro to be:
Application.CalculateFull
It would help if you posted the code and noted which version of Excel is being used.
-
WSalexanderd
AskWoody LoungerJuly 20, 2003 at 2:31 pm #695136further to my request for help .
i have 3 sheets
1) barry 94
2) jim 22
3) ads1
the three sheets have identical programming except for the line
ActiveCell.FormulaR1C1 = _
“=IF(AND(RIGHT(RC[-8],5)=””TOTAL””,RC[-2]>650,RC[-2]650,RC[-2]<750),""YES"","""")"Range("I4").Select
Selection.copy
Range("I5:I1000").Select
ActiveSheet.Paste
Range("I4").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate
Range("A3").Select
Selection.autofilter
Selection.autofilter Field:=9, Criteria1:="YES"
_'########################################################################
If i alter the programme as follows i get a better result which leads me to think i have a timeing problem. cn you help with a solution.
'#########################################################################
Range("A3").Select
Selection.autofilter
Selection.autofilter Field:=9, Criteria1:="YES"
Sheets("jim 22").Select
Range("A3").Select
Selection.autofilter
Selection.autofilter Field:=9, Criteria1:="YES"
Sheets("barry 94").Select
Range("A3").Select
Selection.autofilter
Selection.autofilter Field:=9, Criteria1:="YES"
alex -
WSHansV
AskWoody LoungerJuly 20, 2003 at 9:19 pm #695177I don’t have the slightest idea what your macro is doing, but it can be written much more efficiently by using ranges instead of selecting cells or ranges repeatedly. Also, there are several instructions that seem to be superfluous. Here is a macro that does the same as your code, minus the instructions that I think should be omitted:
Sub Test()
Dim wsh As Worksheet
Set wsh = Worksheets(“barry 94”)
wsh.Columns(“H:M”).Delete
With wsh.Range(“A4”)
.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(7)
.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(7)
End With
wsh.Range(“I4”).FormulaR1C1 = _
“=IF(AND(RIGHT(RC[-8],5)=””TOTAL””,RC[-2]>650,RC[-2]<750),""YES"","""")"
wsh.Range("I4").Copy Destination:=wsh.Range("I5:I1000")
Application.CutCopyMode = False
wsh.Range("A3").AutoFilter Field:=9, Criteria1:="YES"
End SubIf you would like more help, please attach a demo workbook, so that we have an idea of what your data look like. Replace confidential info by dummy data, if necessary.
-
WSJohnBF
AskWoody LoungerJuly 21, 2003 at 1:45 am #695216Alex, and Hans, I can shed a little light on the problem, but I’m also running into a problem with the code, and I hope Hans or another Excel VBA guru can help me out. I attached the demo worksheet I built to answer the problem. The code does a little more than Hans code, as it loops through the three Worksheets. I won’t repeat the code in the post, since it’s in the attachment.
As Hans notes, it’s difficult to know what you are doing without appropriate sample data, but there seem to be some duplication and contradiction in the code, for example
.Range(“A4”).Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(7)
.Range(“A4”).Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(7)the second line overwrites the first, and messes up the formulas later posted in Column I, so I used only the first line, grouping by the Column A totals.
It appears that Subtotal Outlines and AutoFilter do not work well together. When you use an Autofilter in Excel, it excludes rows that do not meet the criteria from any calculations. So when you apply the Autofilter to the outline, all the data rows are excluded, so the Subtotal rows then calculate to zero, and then Autofilter doesn’t find any “YES” values. I used two fixes to covercome this problem in the code: first, I remove the outline, which leaves the Subtotals; second, I turn the column “I” formulas into values.
That done, I still have a problem. If I run the code without the Autofilter line, and then Autofilter manually, I get the desired result. But if I run the Autofilter line by code, I get anomalous results (see code comment). What’s going on?
Alex, as Hans notes, your code was all written through the use of the macro recorder and so is pretty inefficient, particularly regarding the unnecessary use of Select. My code fixes some of those problems, but could be improved further. If you are planning to get into Excel VBA, I recommend you get a book and work through it.
-
WSHansV
AskWoody Lounger -
WSalexanderd
AskWoody Lounger -
WSJohnBF
AskWoody Lounger -
WSalexanderd
AskWoody LoungerJuly 23, 2003 at 5:56 pm #696179sorry for the delay in replying but!!
I thank you all for your comments.it is some times hard to tell one’s peers what one has done without causing them to shake in their boots, but nothing lost, I will endeavour to give a further insite into the reason for and the subsequent programme.
I work in a sales office in which we also have control of the dispatch of all orders taken, the system is so flexible that as shelves are re-stocked with new goods the database is updated, and orders which have reached a certain value are released for packing and delivery.
The system is volatile in as much that the file can have 2400 lines as the attached file or some 7000 line as I have seen in the past 2 days.
I will list the way that I have tried to programme the macro. The file is transferred from a UNIX computer as a CSV file,
Which make it harder to work with?The manual working of removing all superfluous parts could take 3 hours with interruptions the macro takes approx 1.5 minutes.
1) Remove all accounts on stop——————————————– late payer
-
WSalexanderd
AskWoody LoungerJuly 22, 2003 at 6:52 pm #695768 -
WSJohnBF
AskWoody LoungerJuly 23, 2003 at 3:49 am #695894See post 268734 for a discussion on Excel VBA books. The wrox books are usually good, but if you have their reference book, it may assume too much for a beginner.
-
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Cyberattack on some Washington Post journalists’ email accounts
by
Bob99
1 hour, 37 minutes ago -
Tools to support internet discussions
by
Kathy Stevens
4 hours, 21 minutes ago -
How get Group Policy to allow specific Driver to download?
by
Tex265
2 hours, 41 minutes ago -
AI is good sometimes
by
Susan Bradley
4 hours, 43 minutes ago -
Mozilla quietly tests Perplexity AI as a New Firefox Search Option
by
Alex5723
10 hours, 2 minutes ago -
Perplexity Pro free for 12 mos for Samsung Galaxy phones
by
Patricia Grace
1 day, 5 hours ago -
June KB5060842 update broke DHCP server service
by
Alex5723
1 day, 3 hours ago -
AMD Ryzen™ Chipset Driver Release Notes 7.06.02.123
by
Alex5723
1 day, 7 hours ago -
Excessive security alerts
by
WSSebastian42
8 hours, 32 minutes ago -
* CrystalDiskMark may shorten SSD/USB Memory life
by
Alex5723
1 day, 17 hours ago -
Ben’s excellent adventure with Linux
by
Ben Myers
35 minutes ago -
Seconds are back in Windows 10!
by
Susan Bradley
1 day, 4 hours ago -
WebBrowserPassView — Take inventory of your stored passwords
by
Deanna McElveen
10 hours, 45 minutes ago -
OS news from WWDC 2025
by
Will Fastie
8 hours, 8 minutes ago -
Need help with graphics…
by
WSBatBytes
12 hours, 22 minutes ago -
AMD : Out of Bounds (OOB) read vulnerability in TPM 2.0 CVE-2025-2884
by
Alex5723
2 days, 8 hours ago -
Totally remove or disable BitLocker
by
CWBillow
1 day, 7 hours ago -
Windows 10 gets 6 years of ESU?
by
n0ads
1 day, 10 hours ago -
Apple, Google stores still offer China-based VPNs, report says
by
Nibbled To Death By Ducks
2 days, 19 hours ago -
Search Forums only bring up my posts?
by
Deo
3 hours, 56 minutes ago -
Windows Spotlight broken on Enterprise and Pro for Workstations?
by
steeviebops
3 days, 6 hours ago -
Denmark wants to dump Microsoft for Linux + LibreOffice
by
Alex5723
2 days, 23 hours ago -
How to get Microsoft Defender to honor Group Policy Setting
by
Ralph
3 days, 7 hours ago -
Apple : Paragon’s iOS Mercenary Spyware Finds Journalists Target
by
Alex5723
3 days, 17 hours ago -
Music : The Rose Room – It’s Been A Long, Long Time album
by
Alex5723
3 days, 18 hours ago -
Disengage Bitlocker
by
CWBillow
3 days, 8 hours ago -
Mac Mini M2 Service Program for No Power Issue
by
Alex5723
3 days, 20 hours ago -
New Win 11 Pro Geekom Setup questions
by
Deo
3 hours, 44 minutes ago -
Windows 11 Insider Preview build 26200.5651 released to DEV
by
joep517
4 days, 4 hours ago -
Windows 11 Insider Preview build 26120.4441 (24H2) released to BETA
by
joep517
4 days, 4 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.