Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Change LBound of array

I have a (1,1) based array which i want to turn into (0,0) based array,
how do I do this quickly? I think it should simply be a matter of
changing some parameters in the corresponding SAFEARRAY structure, but
I don't know how to do this without causing crashes.

Doing this any other way that actually requires moving the data of the
array in memory is unacceptable. Any help would be appreciated!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Change LBound of array

Have you tired Option Base. Here is a link to the article

http://msdn.microsoft.com/library/de...OptionBase.asp

HTH

"R Avery" wrote:

I have a (1,1) based array which i want to turn into (0,0) based array,
how do I do this quickly? I think it should simply be a matter of
changing some parameters in the corresponding SAFEARRAY structure, but
I don't know how to do this without causing crashes.

Doing this any other way that actually requires moving the data of the
array in memory is unacceptable. Any help would be appreciated!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Change LBound of array

This happens when i do

dim rng as excel.range
dim vnt as variant

set rng=selection
vnt=rng

then vnt will be a (1,1) based array, regardless of the OPTION BASE
statement.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Change LBound of array

R Avery wrote:
This happens when i do

dim rng as excel.range
dim vnt as variant

set rng=selection
vnt=rng

then vnt will be a (1,1) based array, regardless of the OPTION BASE
statement.

Why is it unacceptable to "move the data of the array in memory" to make
the change to 0 base in both dimentions?

Alan Beban
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Change LBound of array

because i know that its possible with a few API calls to change the
base of the SAFEARRAY without having to move the actual data in memory
anywhere. The reason its unacceptable is that it's too slow. I'm
loading like 100 MB of Excel data at a time into an array, many times,
and copying the data to a whole new array would impact performance.

It has to be zero-based because i force all my objects to have
zero-based collections and arrays in order to avoid confusion.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't change part of an array Geoff Newham Excel Worksheet Functions 5 September 1st 09 02:59 PM
change array to simple columns Ray S. Excel Discussion (Misc queries) 7 February 4th 09 05:44 PM
How to change this into array ? broogle Excel Programming 5 March 20th 05 11:08 PM
How to change this into array ? broogle Excel Programming 0 March 18th 05 03:26 AM
Ubound & Lbound Michael168[_80_] Excel Programming 3 June 1st 04 02:00 PM


All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"