Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Stacey:
"Stacey" wrote: I realize Excel has a row limitation of 64K here, Are there more elswhere? I am attempting to retrieve a result set (from MSQuery) which has more rows than Excel allows on one sheet Excel allows 65k+ rows in one column you can use the other columns Basically I'd like to import all rows from the result set into Excel, using multiple sheets. Does any one have any sample code for auto generating a new sheet based on resultSet data (rather than reading from a text file?) Well yes I do , using ADO and you could bring it in to the same sheet or whereever you want it. For Example: This puts the first 65k + 3 field Query into col a b c cnt = Rs.RecordCount '//get record count if you need them MsgBox "Count = " & cnt Dim irow As Long irow = 3 With Rs .MoveFirst Do Until irow = 65536 Worksheets("Sheet3").Range("A" & irow) = Rs("ProductID") Worksheets("Sheet3").Range("B" & irow) = Rs("ProductName") Worksheets("Sheet3").Range("C" & irow) = Rs("UnitPrice") Debug.Print Rs("ProductName") .MoveNext irow = irow + 1 Loop End With cnt2 = Rs.AbsolutePosition '// where we at in the recordset MsgBox "Position = " & cnt2 '/// here we move to d e f for the balance of the recordset '/// see the recordset pointer remembers it's position or you can '/// get it with the above code "Rs.AbsolutePosition" irow = 3 With Rs Do Until .EOF Worksheets("Sheet3").Range("D" & irow) = Rs("ProductID") Worksheets("Sheet3").Range("E" & irow) = Rs("ProductName") Worksheets("Sheet3").Range("F" & irow) = Rs("UnitPrice") .MoveNext irow = irow + 1 Loop End With That's one way, Stacey. If it happens to be an Access db post back and I'll post you some connection code that you can play around with. By the way I brought 88.000, 3 field records into columns a b c and d e f in 64 seconds on an old laptop 1.6 I think. Good Luck TK |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
data with more than 65536 lines | Excel Discussion (Misc queries) | |||
Data exceeds chart limits | Charts and Charting in Excel | |||
How Can I import external data what is more than 65536 lines? | Excel Discussion (Misc queries) | |||
How do I import data into Excel that exceeds 70000 rows? | Excel Discussion (Misc queries) | |||
Import extrenal data exceeds 65536 | Excel Programming |