How to apply a formula (autofill) on a range of cells in Excel using MATLAB COM activeX?

3 vues (au cours des 30 derniers jours)
hamutal
hamutal le 11 Sep 2012
Hello everybody, I was asked to write a code that manipulates a certain data to output as excel document. I read about using COM to work with excel, and have managed to do number of actions like copy&paste special, activating a worksheet etc. Now I can't seem to find the property that allows me to autofill a column with a formula or even applying one on a certain range. I tried to use the code that derives by the macro in Excel, but couldn't translate it write to MATLAB language. Would appreciate your help on the subject, and even a reference to an Index of known properties will help a lot.
Good day, Hamutal

Réponses (3)

hamutal
hamutal le 13 Sep 2012
anyone? please?

Tom
Tom le 13 Sep 2012
Modifié(e) : Tom le 13 Sep 2012
From your active worksheet:
%data:
DataRange = e.Activesheet.get('Range','A1:B1');
DataRange.Value=[1 2];
%equation:
EqnRange = e.Activesheet.get('Range','C1:C1');
EqnRange.Formula='=SUM(A1:B1)';
%open Excel
e.Visible = 1;

hamutal
hamutal le 22 Sep 2012
You've given me the way to apply a formula on a specific cell row. I wan't a way to apply the same formula on an entire range but according to the specific row. (meaning: c1=sum(a1,b1), c2=sum(a2,b2) etc.)

Catégories

En savoir plus sur Use COM Objects in MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by