Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multi dim arrays
#4
Code:
Copy      Help
ARRAY(str) a
ExcelSheetToArray2 a

str s="Hoonah"

int i found
for(i 0 a.len(2)) if(a[0 i]~s) found=1; break
if(found)
,;out a[2 i]
,System(a[0 i] val(a[1 i]) a[2 i])

Function ExcelSheetToArray2:
Code:
Copy      Help
;/
function ARRAY(str)&a

;Stores Excel cells into two-dimensional array.

;EXAMPLE
;ARRAY(str) a
;ExcelSheetToArray a
;int r c
;for r 0 a.len

,;out "-----Row %i-----" r+1
,;for c 0 a.len(1)
,,;out a[c r]


typelib Excel {00020813-0000-0000-C000-000000000046} 1.2

Excel.Application xlApp._getactive; err act; act; xlApp._getactive
Excel.Worksheet ws=xlApp.ActiveSheet
Excel.Range r=ws.UsedRange
int i j nr(r.Rows.Count) nc(r.Columns.Count)
a.create(nc nr)
for i 0 nr
,for j 0 nc
,,a[j i]=r.Item(i+1 j+1)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)