Search notes:

VBA: extract arrays from arrays in Excel

With WorksheetFunction.index function, its possible to extract arrays from an array.
The following example shows how to extract a one dimensional array from a two dimensional array:
'
'   Inspired by https://usefulgyaan.wordpress.com/2013/06/12/vba-trick-of-the-week-slicing-an-array-without-loop-application-index/
'
option explicit

sub main() ' {

    dim table    (1 to 9, 1 to 9) as string
    dim ary1d                     as variant

  '
  ' Set up a simple table and store it
  ' in a two dimensional array (variable table):
  '
    dim i, j as long
    for i = 1 to 9: for j = 1 to 9
        table(i, j) = i & "/" & j
    next j: next i

  '
  ' Extract a one dimensional array from the two
  ' dimensional array:
  '
    ary1d = worksheetFunction.index(table, 4, 0)
    debug.print join(ary1d, " - ")

end sub ' }
Github repository about-VBA, path: /language/arrays/extract-array-1d.bas

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1737503689, '3.139.87.151', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/VBA/language/arrays/extract(65): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78