| View previous topic :: View next topic |
| Author |
Message |
Rory Power User


Joined: 04 Nov 2004 Posts: 51 Location: Brasilia DF, Brasil
|
Posted: Wed Nov 17, 2004 2:04 am Post subject: MyVariant = Range ("A1:J15000") = Possible ? |
|
|
Hi again, due to the sheer volume of data and the masses of formulars in my spreadsheets, in Excel I found things a lot faster to run, by loading all of my data into a variant type variable table ( I have no idea if this is the correct term) in my macros i have many many loops working inside one another and this i found to be much faster than it was working diirectly with cells.
Is this possible in OOo I have been having a play around but to no avail as yet.
Im am still rather new to OOoBasic
Dim MyVariant as Variant
MyVariant = Range("A1:J1500")
any pointers will be much appreciated
thanks in advance again
EDIT***** I think this is called a Variant Array, but I cant find any info on this in OOo*******
EDIT2*** Seems in OOo this is called a DataArray altho still having a little trouble to discover how to use this ?GetDataArray? in VBA I could explore each variable value inside the array via the debuggger will I be able to do this with a Watch and BreakPoint in Ooo?? _________________ Rory
/Cries
OOo 1.1.3/4/5 / 2.0 on Win NT/2000/XP(SP1/2) |
|
| Back to top |
|
 |
Rory Power User


Joined: 04 Nov 2004 Posts: 51 Location: Brasilia DF, Brasil
|
Posted: Wed Nov 17, 2004 8:43 am Post subject: |
|
|
Ok welll a little progress...
In this thread http://www.oooforum.org/forum/viewtopic.php?t=8005&highlight=variant+array
I found this little sample
| Code: | iProb = 0
Set oArea = oSheet.getCellRangeByName("A1:D28595")
nRows = oArea.rows.Count ' Get number of rows
nCols = oArea.Columns.Count ' Get number of columns
' Define the array we will use to store the data. THIS IS THE IMPORTANT BIT
ReDim arrValues(0 To nRows, o To nCols) As Variant
'Get data
arrValues = oArea.getDataArray
' Put data back into cells
oArea.setDataArray (arrValues()) ' This now works! |
But alas this does not actually work for me, to the ReDim command ok all is fine, I creat a variant array the same size as the range I want to place into it, but past this I cant put my range of data into my variant array (Data array)
Any ideas ???? _________________ Rory
/Cries
OOo 1.1.3/4/5 / 2.0 on Win NT/2000/XP(SP1/2) |
|
| Back to top |
|
 |
Rory Power User


Joined: 04 Nov 2004 Posts: 51 Location: Brasilia DF, Brasil
|
Posted: Fri Nov 19, 2004 4:33 am Post subject: |
|
|
Erk,
well things are still not funcionting for me, it appears that ".GetDataArray" does not do what i want it to, it seems to me, and correct me if im wrong, that it in fact creates an array of variables each containing an array of variables.
now I can place my table inside this array of arrays but for me to access one variant is difficult, i need to define the first array to a variable then select the variant do what i want then put it back....
Lost you??? thought so
| Code: | teste = dataArray(5)
teste(5) = "alo"
dataArray(5) = teste |
this puts the string "alo" into dataarray(5,5) (NOTE *dataarray(5,5)*, will not work sadly)
Am I missing something, can i not creat an array(500,500) and place a range of cells into it? _________________ Rory
/Cries
OOo 1.1.3/4/5 / 2.0 on Win NT/2000/XP(SP1/2) |
|
| Back to top |
|
 |
DiGro Super User


Joined: 02 Jun 2004 Posts: 1208 Location: Hoorn NH, The Netherlands
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|