K
K
KillAstronauts2015-02-03 19:50:11
Programming
KillAstronauts, 2015-02-03 19:50:11

How to put a table from Excel into an array of the program?

Hey!
I can not find how to put a table from Excel into the array of the program. The problem is that I do not know in advance the number of lines on the sheet. Rows are sometimes empty! Therefore, running a loop through a column and waiting for the cell to be empty is not an option. Of course, you can make a "limit of empty cells" - if we meet more than a number of empty cells in a row on the loop path, then we will assume that there are no more rows. But the solution is not beautiful, is there already something ready? Maybe there is an easy way to transfer data from Excel to an array?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Elizariev, 2015-02-03
@KillAstronauts

Excel provides for the direct receipt of an array using the language, for example like this:
To get the end of a range, you can use the End property of an object of the Range class.

K
KillAstronauts, 2015-02-04
@KillAstronauts

And to get an array of only filled cells, and not set an interval, you can do this:
Thank you!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question