Stuart’s MATLAB Videos

Watch and Learn

Creating a Function to Format a Spreadsheet

I often export to Excel to share results with others. In doing so I control the format of the output with a template with column widths and heading colors that I have talked about in previous videos (saving to a template, replicating a worksheet template). However, if I change the number of columns in my data, I need to change the template, which is annoying.

So here I try to make a function, where I can specify the column widths and colors as parameters, and therefore change it dynamically to match the columns in my table. It requires interacting with Excel’s object model, which I find difficult and I need to frequently refer to VBA (Visual Basic for Applications ) documentation online.

Features covered in this code-along style video include:

Play the video in full screen mode for a better viewing experience. 

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.