Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Array of Arrays

  Asked By: Kerri    Date: Jan 28    Category: MS Office    Views: 1787
  

When I open a .txt file using openText and recorded the macro, I got
this:

Workbooks.OpenText filename:=filename, _
Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited,
TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,
Semicolon:=False, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1,
2), _
Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 2), Array(6, 2),
Array(7, 2), Array(8, 2), _
Array(9, 2), Array(10, 2), Array(11, 2), Array(12, 2), Array(13, 2),
Array(14, 2), Array(15 _
, 2), Array(16, 2), Array(17, 2), Array(18, 2), Array(19, 2),
Array(20, 2), Array(21, 2), _
Array(22, 2), Array(23, 2))

I am just wondering whether there is any chance I could set up the array
of arrays using a do..while loops or another automated structure,
instead of having to add all the arrays to the array myself. What does
the code looks like?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Vasantha Kumar     Answered On: Aug 11

1 2 3
4 5 6
7 8 9

1 2 3
4 5 6
7 8 9

 
Answer #2    Answered By: Rene Aiza     Answered On: Aug 13

use Map, or matrix

public void agregar(){
Map<Integer,ArrayList<Integer>>a =new HashMap<>();
for (int i = 0; i < 10; i++) {
ArrayList<Integer> array=new ArrayList<>();
for (int j = 5; j < 10; j++) {
array.add(j); //put your data
}
a.put(i, array);
}
}

 
Didn't find what you were looking for? Find more on Array of Arrays Or get search suggestion and latest updates.




Tagged: