Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Copy a formatted sheet in Excel
Replies: 9   Last Post: Jul 11, 2013 6:03 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Ashish Uthama

Posts: 917
Registered: 10/17/08
Re: Copy a formatted sheet in Excel
Posted: Sep 10, 2009 3:51 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Thu, 10 Sep 2009 09:05:19 -0400, Claudio Pedrazzi
<firstnameinitial.lastname@company.it> wrote:

> Hi everybody,
> I am trying to perform the following: a MATLAB application produces
> internally a set of matrices, say A, B, C... Z, everyone of them 10x4.
> I would like to write them to an Excel file (.xlsx) each one in a
> separate sheet. This is easy, and accomplishable with the optional
> "sheet" argument of the xlswrite function.
> BUT...
> I would like to write the data in a preformatted sheet. That is, every
> Excel sheet should be "cloned" from a master one, where there are
> titles, colors, cell formats with a certain number of decimal places,
> specific fonts, and so on.
> For a single sheet, that works perfectly: the matrix of numbers "fits"
> into the prepared format, and that's it. But I would like, at the end,
> to have the .xlsx file containing an "A" sheet, a "B" sheet, up to "Z"
> sheet, all formatted in the same way. If I generate a new sheet, it
> will be a "blank" sheet, and that will not do.
> In my opinion, I need to be able to "copy" an Excel sheet. Or if any of
> you can devise a better way, a MATLAB way to do this, I would appreciate
> it very much
> Thanks a lot and best regards
> Claudio


You will be able to do this using the COM interface to Excel.

For example, this example uses the COM interface to manipulate chart
objects
http://www.mathworks.com/support/solutions/en/data/1-A7X5QT/?solution=1-A7X5QT

Bear in mind that this approach allows you to invoke Excel's VB commands.
You would have to use the Excel documentation to obtain more information
on the COM functions used. You might be able to cobble something using
hints from the above solution and some VBA functions listed here:

http://support.microsoft.com/kb/288402





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.