Forum Discussion

Maureen B Seiferling's avatar
Maureen B Seiferling
Copper Contributor
Jul 14, 2017

Excel 2013 Resource Issues

I have a spreadsheet with 4 worksheets (worst case 15 columns). 

 

One worksheet (WS1) contains a copy of data received from a vendor (database dump).  Via VB, one column is copied to column A for look up purposes.  Another worksheet (WS2) uses formulas to copy data from WS1 by checking for data in column A and if there is a value, each column in each row in WS1 will be copied to the appropriate cell in WS2 (column order is different than what is in WS1 so B2 in WS1 may be placed in D2 in WS2).  Some minor data formatting (i.e. concatenation, date manipulation) is performed on some columns while others are simply a copy of the cell from WS1 to WS2. 

 

With WS2 formatted as required, the entire worksheet is copied then the values placed in another worksheet (WS3) using VB to perform this activity.  Customers are then asked to validate the contents in WS3 (some rows may be changed, rows added, rows deleted).  In theory, only 4 columns should be subject to change because the source of the data comes from a vendor through a data dump from their database so those values should be correct.  If anything, the vendor still shows a row of data in their database that is no longer valid and therefore should be deleted by the customer.  But one column that may require change uses a dropdown to enforce acceptable values (which are initially defaulted to the most likely value and largely the correct value across all rows).  The other 3 columns are simple text data entry (i.e. employee name and email address).  When adding a row using a Ctrl-Shift-I, VB copies data from a row and populates all columns except for 3 which the customer has to update manually and VB puts the cursor on the first of those columns.  This worksheet (WS3) is the only worksheet they have access to and its contents are all data vs formulas.  Any expected formatting for any of the columns is listed in the header but I am relying on the customer to leave data alone in columns that should not need updating but still gives them permission to do so if necessary.  Historically, sending a spreadsheet with formulas or VB has often resulted in the customer advertently altering 'code' and causing data error issues.  So the customer is necessarily prevented from accessing a worksheet containing formulas or triggering VB (through Excel security/protection). 

 

Once the customer sends the spreadsheet back to me with WS3 updated, a fourth worksheet (WS4) contains formulas that pull data from WS3 and does additional formatting necessary to create a separate spreadsheet containing the data in WS4 organized and formatted in the manner necessary to load it in to our database. 

 

The issue is using formulas to copy/format data into another worksheet as well as some VB to perform other functions works without issue with 500 rows of data.  When I increase the number of rows (copying formulas for each cell for both WS2 and WS4) to 1000 rows, Excel takes forever to open.  And the problem is each customer will have a different number of rows they will be working with and the largest number of rows could grow to 15000.  So how do I resolve the resource issue (Excel 2013)?  I can start removing all the formulas and use VB only to perform the same formatting, copying and pasting of each cell from one worksheet to another.  I'm a little bit worried that this approach will also run in to resource issues.  So any area experts that can help provide approaches that will eliminate a resource problem is welcome including sample VB code that will most efficiently loop through rows in one worksheet and copying/formatting each cell in a row to the same row in another worksheet.  I'm hoping those with more expertise particularly when encountering this problem, will be able to provide guidance on choosing efficient formulas, VB code, etc. 

1 Reply

  • Hi Maureen

     

    There's quite a lot happening in your scenario and it may be difficult for people to help via the forum.

     

    However, one quick question is does your VB code turn calculations and screen updating on and off

     

    Sub Example()
    
    
    Application.Calculation = xlCalculationManual
    Application.ScreenUpdating = False
    
    'code
    '...>
    
    
    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True
    
    End Sub