取单元格红色字体的VBA自定义函数

 

代码
1 Function GetColorChar(Rng As Range)
2 Application.Volatile True
3 Dim i%, str$
4 For i = 1 To Len(Rng)
5 If Rng.Characters(i, 1).Font.Color = 255 Then
6 str = str & Mid(Rng.Value, i, 1)
7 End If
8 Next
9 GetColorChar = str
10  End Function

 

效果如下图:

posted @ 2010-03-02 22:20  RobinLao  阅读(1138)  评论(0编辑  收藏  举报