Solved

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

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
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.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

617 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