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, 10 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
-
Xfinity home internet
by
MrJimPhelps
2 hours, 37 minutes ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
1 hour, 11 minutes ago -
Debian 12.11 released
by
Alex5723
9 hours, 38 minutes ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
13 hours, 19 minutes ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
10 hours, 49 minutes ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
9 hours, 47 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
1 day, 6 hours ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
20 hours, 39 minutes ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
1 day, 8 hours ago -
iPhone SE2 Stolen Device Protection
by
Rick Corbett
1 day, 1 hour ago -
Some advice for managing my wireless internet gateway
by
LHiggins
8 hours, 43 minutes ago -
NO POWER IN KEYBOARD OR MOUSE
by
HE48AEEXX77WEN4Edbtm
1 hour, 35 minutes ago -
A CVE-MITRE-CISA-CNA Extravaganza
by
Nibbled To Death By Ducks
1 day, 18 hours ago -
Sometimes I wonder about these bots
by
Susan Bradley
1 day, 14 hours ago -
Does windows update component store “self heal”?
by
Mike Cross
1 day, 4 hours ago -
Windows 11 Insider Preview build 27858 released to Canary
by
joep517
2 days, 8 hours ago -
Pwn2Own Berlin 2025: Day One Results
by
Alex5723
16 hours, 18 minutes ago -
Windows 10 might repeatedly display the BitLocker recovery screen at startup
by
Susan Bradley
4 hours, 56 minutes ago -
Windows 11 Insider Preview Build 22631.5409 (23H2) released to Release Preview
by
joep517
2 days, 11 hours ago -
Windows 10 Build 19045.5912 (22H2) to Release Preview Channel
by
joep517
2 days, 11 hours ago -
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
1 day, 23 hours ago -
The Surface Laptop Studio 2 is no longer being manufactured
by
Alex5723
2 days, 19 hours ago -
0Patch, where to begin
by
cassel23
2 days, 13 hours ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
3 days, 8 hours ago -
89 million Steam account details just got leaked,
by
Alex5723
2 days, 20 hours ago -
KB5058405: Linux – Windows dual boot SBAT bug, resolved with May 2025 update
by
Alex5723
3 days, 17 hours ago -
A Validation (were one needed) of Prudent Patching
by
Nibbled To Death By Ducks
3 days, 8 hours ago -
Master Patch Listing for May 13, 2025
by
Susan Bradley
10 hours, 32 minutes ago -
Installer program can’t read my registry
by
Peobody
2 hours, 26 minutes ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
3 days, 6 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.