daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Sub ArrayofArrays()
  4.  
  5. Dim OuterArray() As Variant
  6. ReDim OuterArray(0 To 0)
  7.  
  8. Dim InnerArray() As Variant
  9. ReDim InnerArray(0 To 0)
  10.  
  11. InnerArray(0) = "Foo"
  12. OuterArray(0) = InnerArray
  13.  
  14. ReDim Preserve OuterArray(LBound(OuterArray) To UBound(OuterArray) + 1)
  15. End Sub
  16.    
  17. debug.print OuterArray(0)(0)
  18.    
  19. ReDim Preserve OuterArray(LBound(OuterArray) To UBound(OuterArray) + 1)
  20.    
  21. Option Explicit
  22.  
  23. Sub ArrayofArrays()
  24.     Dim tmp As Variant
  25.     Dim OuterArray() As Variant
  26.     ReDim OuterArray(0 To 0)
  27.  
  28.     Dim InnerArray() As Variant
  29.     ReDim InnerArray(0 To 0)
  30.  
  31.     InnerArray(0) = "Foo"
  32.     OuterArray(0) = InnerArray
  33.  
  34.     tmp = OuterArray(0)
  35.     ReDim Preserve tmp(LBound(tmp) To UBound(tmp) + 1)
  36.     OuterArray(0) = tmp
  37.     OuterArray(0)(1) = "Bar"
  38.  
  39.     Debug.Print OuterArray(0)(1)
  40. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top