How to select only the non empty Excel cell in a line

Getting started -basics for starting with WinTask

How to select only the non empty Excel cell in a line

Postby cristian on Mon May 05, 2014 7:21 am

Hi,
We need the script to read a line of cells for example E2-Q2 and only one of those cells will have data in and that will change all the time, so is there a way to read across and the first cell with data in, capture and paste into a separate cell automatically.
cristian
 
Posts: 8
Joined: Sun Jul 31, 2005 5:01 pm

Re: How to select only the non empty Excel cell in a line

Postby TechSupport on Tue May 06, 2014 8:00 am

Hello,

ReadExcel populates an array, so:
ReadExcel("myfile.xlsx","E2:Q2",data$())
data$(0) contains the E2 cell
data$(1) contains F2 cell and so on.
You can then create a loop and exit the loop when the non empty cell is found. The loop would look like:
exit=0
i=0
repeat
If data$(i)="" then
exit=1
EndIf
i=i+1
until i=12 or exit=1
nonempty$=data$(i-1)

Regards.
WinTask Tech Support
TechSupport
 
Posts: 805
Joined: Thu Nov 16, 2006 9:58 am


Return to Getting started

Who is online

Users browsing this forum: No registered users and 0 guests

cron