Select Cell Range in Excel ActiveX

4 Ansichten (letzte 30 Tage)
Glenn Kightley
Glenn Kightley am 29 Feb. 2012
Kommentiert: Jean OMB am 9 Jul. 2021
Hi,
I'm hoping someone can help with a GUI i'm building that interacts with an Excel ActiveX object. I'm trying to get my GUI to report the RANGE which has been selected my the mouse, rather than the active cell which forms only one corner of the range.
has been some help, however the function:
ActRange = get(Spreadsheet1,'Range');
Does not appear supported, or if it is, I can't figure out how to extract the value e.g. 'a1:b5'
Does anyone know a work around?
Thanks in advance,
Glenn

Akzeptierte Antwort

Friedrich
Friedrich am 29 Feb. 2012
Hi,
as far as I know there is no function for that in EXCEL. You have to get it yourself with the Adress property of the Cell object:
selected_range = [strrep(ex.Selection.Cells.Item(1).Address,'$',''),':',strrep(ex.Selection.Cells.Item(ex.Selection.Cells.Count).Address,'$','')]
Here ex is the handle to the EXCEL automation server.
  5 Kommentare
Image Analyst
Image Analyst am 23 Jun. 2013
How do you propose to let the computer know that you have selected the final range? I mean, you could click on various cells, and even highlight some rectangles, before you decide to "go with" the current selection. How do you tell it you're ready to leave Excel and continue with your MATLAB code?
Jean OMB
Jean OMB am 9 Jul. 2021
Hi, im learning on how to work with Activex and I was wonedering if any of you guys were able to open an excel file from matlab and select a range of cells with the mouse? if you did, can you show the code?Thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by