|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 niko88819 于 2024-8-9 09:02 编辑
J2 公式 =COLORTEXT(B2:H2,"") 下拉
- Function COLORTEXT(rng As Range, delimiter As String) As String
- Dim cell As Range
- Dim result As String
- For Each cell In rng
- Dim text As String
- text = cell.Value
- Dim hasRed As Boolean
- hasRed = False
- Dim i As Long
- For i = 1 To Len(text)
- If cell.Characters(i, 1).Font.Color = RGB(255, 0, 0) Then
- hasRed = True
- Exit For
- End If
- Next i
- If hasRed Then
- result = result & text & delimiter
- End If
- Next cell
- If Len(result) > 0 Then
- result = Left(result, Len(result) - Len(delimiter))
- End If
- COLORTEXT = result
- End Function
复制代码
|
评分
-
1
查看全部评分
-
|