LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How can I get only visible cells using range.get_Value?

Hi All!

Ive a code on C# that reads the data from Excels spreadsheet.
I use Excel.Worksheet.get_Range method to get a Excel.Range object like this:

Excel.Range range = Worksheet.get_Range("A1", Missing.Value);

After I got the range I read the data into a multi-dimensional array as
following:

Object[,] saRet;
saRet = (System.Object[,])range.get_Value(Missing.Value);

Everything works fine until I want to get only visible cells from the
spreadsheet. So I use the code:

range = range.SpecialCells(xlCellTypeVisible, Missing.Value);

When I try to invoke the range.get_Value(Missing.Value) method I got an
exception that states it cannot cast a string to Object[,].

So, Im confused about what SpecialCells(xlCellTypeVisible) returns.
Could anyone provide me a hint how to get only visible range from the
spreadsheet?

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set Range of Visible Cells iamito Excel Programming 1 November 7th 07 04:50 PM
Selecting an offset of a range of visible cells, but only those <0? Keith Excel Programming 2 February 4th 07 08:12 PM
How do I include only visible cells in a range? Frequent User Excel Worksheet Functions 1 November 28th 05 04:31 PM
Sum only visible cells within a range. Jason Kendall Excel Programming 4 July 14th 05 05:18 PM
Trying to select the visible range of cells Selector Excel Programming 1 February 1st 04 08:40 PM


All times are GMT +1. The time now is 05:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"