Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Range ... how to know if it is empty

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nicolas.gendron@gmail.com - 26 Jan 2006 16:19 GMT
Hi,

I'm using COM automation inside an xll to program Excel.
At one point in the code, I do the following to retreive a Range of
cells :

"range = range.GetResize(COleVariant(rows), COleVariant(cols));"

Is there a way (other than iterate over all the cells in the range) to
know if the range is empty?

Thanks.

By the way, is there a place where I can find some documentation of
those Excel Ole object?

Nic
Otto Moehrbach - 26 Jan 2006 16:48 GMT
You can count the number of occupied cells and see if it is zero.  For
instance:
If Application.COUNTA(TheRange) = 0 Then .............
HTH   Otto
> Hi,
>
[quoted text clipped - 13 lines]
>
> Nic
tony h - 26 Jan 2006 17:07 GMT
have a look at the specialcells property of a range. You may find one of
these will answer your needs.

eg: Set rngb = rnga.SpecialCells(xlCellTypeBlanks)

Regards,

Signature

tony h

nicolas.gendron@gmail.com - 30 Jan 2006 15:23 GMT
Thanks, it works great.

And what if I have another representation of the Range like an XLOPER
array.

_result.xltype = xltypeMulti;
_result.val.array.lparray = xlValues;

where xlValues is an array of XLOPER

- Is there a way to take the array, make a COM Range object and call
the COUNTA function?

- Or should I loop over all elements of the array

- Or is there another undocumented C Api function for this ;-)

Thanks,

Nic
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.