How to set characters font in excel by m-file?
Ältere Kommentare anzeigen
Hi all
In VBA, for one cell, I can use 'ActiveCell.Characters(Start:=2, Length:=2).Font.Color = -16776961' to set 2nd and 3rd Characters font color to red.

Now, I want to do the same thing by m-file. But code like this
Worksheet.Range('A1').Characters('Start:=2, Length:=2').Font.ColorIndex = 3; %red
told me index overflow, I guess 'Start:=2, Length:=2' is wrong way to do this. What should I do? Thanks.
5 Kommentare
Walter Roberson
am 13 Jul. 2022
I suggest experimenting with
Worksheet.Range('A1').Characters(2, 2).Font.ColorIndex = 3; %red
Steven Lord
am 18 Jul. 2022
Can you show us the code you used to create the variable named Worksheet?
kei hin
am 6 Sep. 2023
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Spreadsheets finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!