Solved

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

Posted on 2014-02-14
4
1,245 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
  • 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 33

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

820 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