Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Large Excel spreadsheet calculates when using VBA code to open a csv file

Posted on 2014-02-14
4
Medium Priority
?
1,265 Views
Last Modified: 2014-02-20
Environment: Windows 8.1, Excel 2013, 64 bit, 6 gigs RAM

I have a large (300 Mg) workbook which uses VBA code to open and load data from .csv files to various sheets.

When the code to open the .csv file executes, the main workbook goes into calculation mode (even though calculation is set to manual both in the excel formulas tab and in the VBA code)
This calculation can take up to 30 minutes each time a .csv file is opened ( about 12 of them).

This behavior just started, as previously over the last week of development, the .csv file would open instantly, The VBA code would copy and paste the data of interest into the appropriate sheet instantaneously.

I have used both Excel 2010 and 2013 64 bit to open the workbook and execute the code with the same results.  

I tried upgrading from windows 8.0 to 8.1 and still have the same results.

Please provide some specific steps which will stop the calculation behavior until the VBA module executes a range calculate or an application calculate instruction.

Thanks
0
Comment
Question by:wheat01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 19

Expert Comment

by:regmigrant
ID: 39860880
difficult to debug without a copy of the code but I would try adding the following before each file open:-

if application.calculation <>xlcalculationmanual Then
                  debug.print "not manual"& <some way of identifying where the code is at>
                  application.calculation = xlcalculationManual
          Endif

Open in new window


if the problem persists after this post back but at least it should prove the manual calc is in place before the file is read.
0
 
LVL 34

Expert Comment

by:Norie
ID: 39860890
Have you tried importing the data from the CSV file via Data>From Text?

That might stop the calculation that happens when you open a file.
0
 

Accepted Solution

by:
wheat01 earned 0 total points
ID: 39861696
Neither comment resolved the issue or lead to the resolution.  The workbook calculating in spite of having the calculation method set to manual for the workbook and issuing several application.calculation = xlCalculationManual statements in the code was resolved as follows:

Count = ThisWorkbook.Sheets.Count

For i = 1 To Count
  Sheets(i).EnableCalculation = False
Next

However, thanks for your input.
0
 

Author Closing Comment

by:wheat01
ID: 39872903
Reason is contained in my post. Thanks.
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question