Azzera filtri
Azzera filtri

How to set Excel cell color to from Matlab using R1C1 range notation?

14 visualizzazioni (ultimi 30 giorni)
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 Commenti
Allen
Allen il 29 Gen 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.
Don Kalinich
Don Kalinich il 29 Gen 2020
Thanks! Writing something like xlscol was going to be my next step. I implemented Mr. Crosby's xlscol and it works like charm.

Accedi per commentare.

Risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by