1

I am writing a Matlab function to position the Chart in the Excel Sheet( Workbook ). I am using the following code to resize and position it.

Excel.ActiveSheet.ChartObjects.Width=400;
Excel.ActiveSheet.ChartObjects.Height=250;
Excel.ActiveSheet.ChartObjects.Left=50;
Excel.ActiveSheet.ChartObjects.Top=200;

As you notice, the postion, size are hardcoded. I would like to position the image where I can specify the cell address or the range to place the chart.

Thanks

1 Answer 1

2

I have never worked in matlab but see if something like this helps you. BTW I am not sure about the () at the end of .Top and .Left

The below code should position the chart at B2

rRange = e.Activesheet.get('Range', 'B2');
Excel.ActiveSheet.ChartObjects.Left = rRange.Left();
Excel.ActiveSheet.ChartObjects.Top = rRange.Top();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.