[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.6

Excel/VBA: Macro using COM hangs on large ranges

Asked by pgloor in Microsoft Excel Spreadsheet Software

Tags: large

From a Lotus Notes application I need to import large amounts of data from Excel tables (ranges with 6 columns and up to 61,000 rows). Unfortunately, if I work on a range object, Excel hangs after excatly 10921 rows have been processed. If I work directly on a worksheet object, Excel hangs after 5461 rows have been processed (excatly the half).

Excel is Microsoft Excel 2002 (10.5815.4219) SP-2, German edition.
The OS is Microsoft Windows Millenium Edition, 4.900.3000, German edition.
The PC is a DELL Dimension 8200, Intel Pentium 4, 1800 MHz, 512 MB RAM.

It seems to be an OS related problem. A colleage tried the code on Windows/XP and it worked (not sure Excel was the same version). Another colleage tried the code on Windows/ME and had the same problem.

The following code (VBA macro) demonstrates the problem. It can be run from an Excel workbook.
You need a excel file, c:\testdata.xls, having range "A1:F30000" filled with data in Table1.

Sub Test()
    Dim xlApplication As Application
    Dim xlWorkbook As Workbook
    Dim xlWorksheet As Worksheet
    Dim xlRange As Range

    Dim strData1 As String
    Dim strData2 As String
    Dim strData3 As String
    Dim strData4 As String
    Dim strData5 As String
    Dim strData6 As String

    Dim i As Long

    Set xlApplication = CreateObject("Excel.Application")
    Set xlWorkbook = xlApplication.Workbooks.Open("c:\TestData.xls")
    Set xlWorksheet = xlWorkbook.Worksheets("Table1")
    Set xlRange = xlWorksheet.Range("A1:F30000")

    For i = 2 To xlRange.Rows.Count
        Debug.Print i
        ' hangs here at i = 10922
        strData1 = CStr(xlRange(i, 1).Value)
        strData2 = CStr(xlRange(i, 2).Value)
        strData3 = CStr(xlRange(i, 3).Value)
        strData4 = CStr(xlRange(i, 4).Value)
        strData5 = CStr(xlRange(i, 5).Value)
        strData6 = CStr(xlRange(i, 6).Value)
    Next
End Sub

Be warned, it will crash your system!

Peter
 
Related Solutions
Keywords: Excel/VBA: Macro using COM hang…
 
Loading Advertisement...
 
[+][-]03/04/04 04:40 AM, ID: 10513273Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Microsoft Excel Spreadsheet Software
Tags: large
Sign Up Now!
Solution Provided By: bruintje
Participating Experts: 1
Solution Grade: C
 
[+][-]03/04/04 06:12 AM, ID: 10513902Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/04/04 06:28 AM, ID: 10514075Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/04/04 06:34 AM, ID: 10514147Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03/04/04 06:43 AM, ID: 10514223Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/04/04 06:46 AM, ID: 10514256Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/04/04 06:54 AM, ID: 10514347Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/04/04 06:59 AM, ID: 10514409Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92