如何在Excel中更改文本的颜色 [英] how the colour of text can be changed in excel
本文介绍了如何在Excel中更改文本的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好.
我正在用C#编写项目,并在silverlight3中进行设计.
我正在用Silverlight3制作Excel表..
如何在excel中更改所选文本的颜色..
在此先感谢..
Hello to all..
I am making the project as coding in c# and designing in silverlight3.
I am making the excel sheet in silverlight3..
How can I change the colour of selected text in excel..
Thanks in advance..
推荐答案
我使用Excel的记录宏的功能来生成以下代码:
I used Excel''s ability to record macros to generate the code below:
Sub Macro1()
''
'' Macro1 Macro
''
''
Range("A1").Select
ActiveCell.FormulaR1C1 = "blablabla"
With ActiveCell.Characters(Start:=1, Length:=2).Font
.Name = "Calibri"
.FontStyle = "Regular"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
With ActiveCell.Characters(Start:=3, Length:=4).Font
.Name = "Calibri"
.FontStyle = "Regular"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -16776961
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
With ActiveCell.Characters(Start:=7, Length:=3).Font
.Name = "Calibri"
.FontStyle = "Regular"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
Range("A2").Select
End Sub
该宏的作用是在单元格A1中选择第三个到第六个字符,然后将颜色更改为红色.希望对您有所帮助.
What this macros does is select the third through sixth character in cell A1 and change the color to red. I hope that helps.
这篇关于如何在Excel中更改文本的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文