![]() |
|
|
|||||||
| FlashChat | Actuarial Discussion | Preliminary Exams | CAS/SOA Exams | Cyberchat | Around the World | Suggestions |
D.W. Simpson and Company -- Actuary Salary
Surveys |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
OK, I'm working on the Access-Excel problem I mentioned in this thread.
I need to transpose a large array (about 15000x2), so it will paste into Excel correctly. I'm using this code to get the array: Code:
Set qdf = CurrentDb().QueryDefs("Query1")
Set recSummary = qdf.OpenRecordset
recSummary.MoveLast
recSummary.MoveFirst
varArray = recSummary.GetRows(recSummary.RecordCount)
Code:
objExcel.Range("A1").Resize(intRows + 1, intFields + 1).Value = varArray
The array is too big to transpose using the Transpose function. Any suggestions?
__________________
Liberals tend to view themselves as live-and-let-live people.... We’re the nice guys. We believe in tolerance, diversity, and letting people be what they have to be. It’s hard for us to credit the idea that someone could be afraid of us. Someone is. And for good reasons. Understanding that uncomfortable fact is the first step towards grasping what has been going on in this country’s politics for the last quarter century. Red Family, Blue Family Last edited by SamChevre; 12-08-2005 at 02:24 PM.. |
|
#2
|
||||
|
||||
|
why not use rangeVar.CopyFromRecordset recordsetName
|
|
#3
|
||||
|
||||
|
I know ZERO about VBA for Access.
But to transpose in Excel you could Dim A ( 10000,10) Dim B ( 10, 10000) For X = 1 to 10000 For Y = 1 to 10 Set B(Y, X) = A.cells (X,Y) Next Y Next X
__________________
Looks like the parastie is going to have to find another life to go after. He sucked all the enjoyment of visting this place out of me. |
|
#4
|
||||
|
||||
|
Quote:
__________________
Liberals tend to view themselves as live-and-let-live people.... We’re the nice guys. We believe in tolerance, diversity, and letting people be what they have to be. It’s hard for us to credit the idea that someone could be afraid of us. Someone is. And for good reasons. Understanding that uncomfortable fact is the first step towards grasping what has been going on in this country’s politics for the last quarter century. Red Family, Blue Family |
|
#5
|
||||
|
||||
|
Quote:
__________________
Liberals tend to view themselves as live-and-let-live people.... We’re the nice guys. We believe in tolerance, diversity, and letting people be what they have to be. It’s hard for us to credit the idea that someone could be afraid of us. Someone is. And for good reasons. Understanding that uncomfortable fact is the first step towards grasping what has been going on in this country’s politics for the last quarter century. Red Family, Blue Family |
|
#6
|
||||
|
||||
|
Quote:
so your line of code looked like: objExcel.Range("A1").CopyFromRecordset recSummary this caused a problem? |
|
#7
|
||||
|
||||
|
Quote:
Code:
Dim objExcel As New Excel.Application
Dim qdf As QueryDef
Dim recSummary As Recordset
objExcel.Workbooks.Open "C:\SamChevre.xls"
Set qdf = CurrentDb().QueryDefs("Query1")
Set recSummary = qdf.OpenRecordset
objExcel.Workbooks("SamChevre.xls").Sheets("Data").Activate
objExcel.Sheets("Data").Range("A1").CopyFromRecordset (recSummary)
__________________
Liberals tend to view themselves as live-and-let-live people.... We’re the nice guys. We believe in tolerance, diversity, and letting people be what they have to be. It’s hard for us to credit the idea that someone could be afraid of us. Someone is. And for good reasons. Understanding that uncomfortable fact is the first step towards grasping what has been going on in this country’s politics for the last quarter century. Red Family, Blue Family |
|
#8
|
|||
|
|||
|
Theres' a 256 column limit in Excel. Therefore, you can't squeeze 1000 columns into one sheet, no matter what macro you use.
|
|
#9
|
||||
|
||||
|
Yes, you cannot go beyond 256 columns.... But I'm sure our poster knows this.
Why don't you find out what the max number of args are for the Transpose function is. Break your array into piece so that the transpose function takes it. Then make a program that recombines your arrays at the end. It will probably be the fasted way. Also, the loop in the previous post would be slow since it access the worksheet 100,000 times. You want to do everything in VBA first then put it in the worksheet. The less you access the worksheet during a procedure the better. |
|
#10
|
||||
|
||||
|
Doesn't the new version of Excel support more than 256 columns? Perhaps the poster has the latest and greatest.
Me? I'm stuck in 2000. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|