+ Reply to Thread
Results 1 to 5 of 5

Print huge results in external file

  1. #1
    Registered User
    Join Date
    12-18-2012
    Location
    Prilep, Macedonia
    MS-Off Ver
    Excel 2010
    Posts
    15

    Print huge results in external file

    Hi guys.
    I have a problem with printing the result in a external file. I make combinations of all 3 columns, which gives huge number of combinations, like 10Mil combinations, and because there is not enough space in the cells in excel, it gives error after a long time working, but it still gets to the number 1Mil. So I want all those combinations to be written in an external txt file, not in the same file (in this case in the D Row). Do you have a solution to my problem?
    Thanks a lot!

    Here is my code, and it writes the result into the D column:

    Sub comb()
    Dim col1 As Range
    Dim col2 As Range
    Dim col3 As Range
    Dim combination As Range
    Dim counter
    Set combination = Worksheets(1).Range("D:D")
    counter = 1
    With Worksheets(1)
    For Each col1 In .Range("A1", .Range("A" & .Rows.Count).End(xlUp))
    For Each col2 In .Range("B1", .Range("B" & .Rows.Count).End(xlUp))
    For Each col3 In .Range("C1", .Range("C" & .Rows.Count).End(xlUp))
    combination(counter) = col1.Value & "." & col2.Value & "@" & col3.Value
    counter = counter + 1
    Next col3
    Next col2
    Next col1
    End With
    End Sub

    So, as I told, I want the result to be written not in D, but in some external text file.

    Thanks again

  2. #2
    Valued Forum Contributor
    Join Date
    12-05-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010 & 2013
    Posts
    308

    Re: Print huge results in external file

    Hi

    Try the following. You will need to change the file name to suit.
    Please Login or Register  to view this content.
    Cheers, Rob.

  3. #3
    Registered User
    Join Date
    12-18-2012
    Location
    Prilep, Macedonia
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Print huge results in external file

    Thank you a lot!
    You helped me a lot! I appreciate it.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Print huge results in external file

    If you're working with that much data it's better not to call to the worksheet in each iteration, it slows things down, copy the data into memory first.

    based on rcsmith's code:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-18-2012
    Location
    Prilep, Macedonia
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Print huge results in external file

    Niiice
    Thank you Kyle123

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1