|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
单元格内,设置指定字符串的字体格式,如下:
工作簿1.zip
(9.44 KB, 下载次数: 10)
附件:
- Sub Text()
- With ActiveSheet
- Dim S1 As Byte, L1 As Byte
- S1 = VBA.InStr(.Range("C2"), "(")
- L1 = VBA.Len(.Range("C2"))
- With .Range("C2").Characters(Start:=S1, Length:=L1)
- .Font.Name = "宋体"
- .Font.Bold = False
- .Font.Size = 9
- .Font.ColorIndex = 3
- End With
- S1 = VBA.InStr(.Range("F2"), "(")
- L1 = VBA.Len(.Range("F2"))
- With .Range("F2").Characters(Start:=S1, Length:=L1)
- .Font.Name = "宋体"
- .Font.Bold = False
- .Font.Size = 9
- .Font.ColorIndex = 3
- End With
- S1 = VBA.InStr(.Range("d5"), "(")
- L1 = VBA.Len(.Range("d5"))
- With .Range("d5").Characters(Start:=S1, Length:=L1)
- .Font.Name = "宋体"
- .Font.Bold = False
- .Font.Size = 9
- .Font.ColorIndex = 3
- End With
- End With
- End Sub
复制代码 能否帮忙改进一下,写个类模块或函数的,可以在过程中直接调用,
如:
sub 测试
函数名("C2","F2","D5")
end sub
谢谢!
|
|