How to set characters font in excel by m-file?
Afficher commentaires plus anciens
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 commentaires
Walter Roberson
le 13 Juil 2022
I suggest experimenting with
Worksheet.Range('A1').Characters(2, 2).Font.ColorIndex = 3; %red
Steven Lord
le 18 Juil 2022
Can you show us the code you used to create the variable named Worksheet?
kei hin
le 6 Sep 2023
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!