+ Reply to Thread
Results 1 to 21 of 21

What if SQL query return more records than excel sheet row limit?

Hybrid View

  1. #1
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,327

    Re: What if SQL query return more records than excel sheet row limit?

    #1: Yes
    #2: Just copy the header range from the first 5 columns each time.
    Everyone who confuses correlation and causation ends up dead.

  2. #2
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Re: What if SQL query return more records than excel sheet row limit?

    Quote Originally Posted by rorya View Post
    #2: Just copy the header range from the first 5 columns each time.
    You are right, my brain is short circuit.

    Thank you.

  3. #3
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Re: What if SQL query return more records than excel sheet row limit?

    Quote Originally Posted by rorya View Post
    #1: Yes
    #2: Just copy the header range from the first 5 columns each time.
    Dim OutputCell as Range
    set outputCell = WB.Sheets("Download Sheet").Cells(2, 1)
    do until RecordDownloadRs.EOF
    WB.Sheets("Download Sheet").Range("A1:A5").Copy
    outputcell.offset(-1, 6).PasteSpecial Paste:=xlPasteValues
    outputcell.CopyFromRecordset RecordDownloadRs, 1000000, 5
    set outputcell = outputcell.offset(, 6)
    loop
    Sorry for bothering again, not familiar with Offset, what is wrong with the code? It only copies first field name, not the other four field names.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Writing a SELECT query to return only records with duplicate values in one column
    By mc84excel in forum Access Tables & Databases
    Replies: 3
    Last Post: 04-24-2015, 12:16 AM
  2. Excel query/macro , delete records where the aggregate value is not over 100
    By guitarplyr in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-17-2015, 02:59 PM
  3. Query Access database and return all records to Excel
    By bfs3 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2014, 11:01 PM
  4. Replies: 2
    Last Post: 12-20-2013, 01:09 PM
  5. [SOLVED] Query Oracle using range in Excel to return individual records for each cell in range
    By bigwillydier in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-18-2013, 06:37 PM
  6. VBA Read, write records to one sheet. Query
    By dan007004 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-21-2011, 03:03 AM
  7. [SOLVED] How do I get beyond the upper limit of 65,500 records on Excel?
    By Nicholas Korsakov in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-01-2005, 12:05 PM

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