LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Copy Array pointer rather than entire array

When I have two arrays, Ar1 and Ar2, whenever I set Ar2=Ar1, it copies
Ar1 to another location and sets Ar2 equal to that clone... so that they
are not pointing to the same memory. Is there anyway to change this
behavior so that both Ar1 and Ar2 point to the same location in memory?

For example, how would I modify the following code to do print out the
same value. Perhaps the CopyMemory or other API function?



Sub ArrayTest()
Dim Ar1(2) As Long, Ar2() As Long

Ar1(0) = 190
Ar1(1) = 190
Ar1(2) = 190

Ar2 = Ar1

Ar2(1) = 222

Debug.Print Ar2(1), Ar1(1)
End Sub






 
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
Complex conditional summing - array COUNT works, array SUM gives#VALUE fatcatfan Excel Worksheet Functions 4 November 18th 09 06:41 PM
Prevent cell/array references from changing when altering/moving thecell/array nme Excel Discussion (Misc queries) 1 September 19th 08 01:53 PM
meaning of : IF(Switch; Average(array A, array B); array A) DXAT Excel Worksheet Functions 1 October 24th 06 06:11 PM
Filling excel entire row/column instead of single cell from an array shitij Excel Worksheet Functions 3 July 13th 05 07:44 AM
How do I return an entire row of data from a reference array? tvmodica Excel Worksheet Functions 2 January 7th 05 08:52 PM


All times are GMT +1. The time now is 11:42 AM.

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"