Excel - copy excel filtered cells

5 views (last 30 days)
Lucas SCHUBER
Lucas SCHUBER on 9 Jan 2020
Commented: Bob Thompson on 9 Jan 2020
I have a set of data (several rows and several columns) in one excel spreadsheet. It's possible to apply filter on some columns and as a result some rows become hidden.
I would like to copy the visible cells only but when I select some rows using "Range" matlab gets every rows existing inside the defined range, the visible ones and the hidden one.
Is there a way to select the visible cells only ? Or do you have any idea to go around it ?
Thanks a lot!
  3 Comments
Lucas SCHUBER
Lucas SCHUBER on 9 Jan 2020
The filtering can be various and is not predictable. One example would be to filter all the empty cells of one column.
At the moment I use an excel macro to copy the filtered data only and paste it in a new spreadsheet read by matlab.
When I copy/paste manually the filtered data, I only get the visible cells (not the ones hidden between the visible ones). My guess was that it should be possible to code that same process. Maybe there is a flag making the distinction between visible and hidden cells once a filter is applied ?
Bob Thompson
Bob Thompson on 9 Jan 2020
It might be possible to identify the visibility flag using the ActX server, but doing so would force you to probably rewrite your entire interction with Excel. I suggest sticking with the macro you have written now, unless there are more specific issues of why you don't like that method.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!