Page 7 of 8

Re: How do i call a procedure

Posted: Tue Sep 05, 2017 12:22 pm
by serge_girard
Robert,

Try this:

Code: Select all

oExcel:WorkSheets(1):UsedRange:Rows:Count
This will also count empty rows.

Serge

Re: How do i call a procedure

Posted: Tue Sep 05, 2017 2:03 pm
by mol
So, go to line no. 65535 and decrease loop control util you reach first not empty row

Re: How do i call a procedure

Posted: Tue Sep 05, 2017 2:08 pm
by serge_girard
Easier:

Code: Select all

 
for i = 1 to oExcel:WorkSheets(1):UsedRange:Rows:Count
  // do somethings
next
 

Re: How do i call a procedure

Posted: Tue Sep 05, 2017 3:01 pm
by mol
I didn't know UsedRange. Thank you, Serge!

Re: How do i call a procedure

Posted: Tue Sep 05, 2017 4:12 pm
by serge_girard
Google...internet ... !
New for me too!

Serge

Re: How do i call a procedure

Posted: Tue Sep 05, 2017 5:59 pm
by KDJ
mol wrote:
Tue Sep 05, 2017 6:48 am
...
xlUp is defined in excel.ch as:

Code: Select all

#DEFINE xlUp   -4162
Where is excel.ch, I have not found.

Here is MS Excel documentation in single file (EXCEL 2013 Developer Documentation.chm): https://www.microsoft.com/en-us/downloa ... x?id=40326

Re: How do i call a procedure

Posted: Tue Sep 05, 2017 6:26 pm
by mol
I found excel.ch few years ago, I don't remember where. I can post it from my computer

Re: How do i call a procedure

Posted: Tue Sep 05, 2017 6:52 pm
by ROBROS
Serge,

that sounds good,I will try it tomorrow at my office, on my Linux PC I have no excel installed, though I have virtualbox installed I have no licence to install excel.
Mareks proposal for checking for the first empty row doesn't work for me, but:
The last row has a cell always containig the same string (it's a footer row) so I could check instead for this string and then exit the loop.
Or I will check backwards for the first not emtpy row. (sophisicated)
I think this method is sure better, maybe one day they change the footerrow

Btw I think for further questions which I am afraid will occur, I will open a new thread with a new topic.

Guys, you are great, thank you so much.

Robert

Re: How do i call a procedure

Posted: Tue Sep 05, 2017 6:56 pm
by ROBROS
mol wrote:
Tue Sep 05, 2017 6:26 pm
I found excel.ch few years ago, I don't remember where. I can post it from my computer
Marek,

that would be great.

Re: How do i call a procedure

Posted: Wed Sep 06, 2017 6:44 am
by ROBROS
Just to give a feeback:

Serge's suggestion is working. :D