How to set Excel cell color to from Matlab using R1C1 range notation?
14 views (last 30 days)
Show older comments
This question is related to this one:
https://www.mathworks.com/matlabcentral/answers/3352-how-to-set-excel-cell-color-to-red-from-matlab
And the question is, can the Range be specifed in R1C1 notation rather than A1 notation? And if so, how?
WB.Worksheets.Item(1).Range('A1').Interior.ColorIndex = 3;
I have tried the following with no success:
WB.Worksheets.Item(1).Range(cells(i+1,j+1),cells(i+1,j+1)).Interior.ColorIndex = str2double(outTblColor{i,j});
Thanks for the help.
2 Comments
Allen
on 29 Jan 2020
As alternative to trying to work with R1C1 notation (never was successful using this via ActiveX), you could use the xlscol function (FileExchange) to convert R1C1 input to the standard A1 notation.
The following code segment shows one way of converting your i and j variables to row and columns text, respectively.
A1notation = sprintf('%s%s',xlscol(j),i+48); % Adding 48 to i corrects for ASCII values of numeric characters.
Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!