phuynh 发表于 2022-7-6 19:40:07

Excel VBA:单元格背景列

基于RGB值的Excel可视单元格背景
 
这是我的用途,

 
 
Function bgRGB(r, g, b)
    Dim clr As Long, src As Range, sht As String, f, v
    If IsEmpty(r) Or IsEmpty(g) Or IsEmpty(b) Then
      clr = vbWhite
    Else
      clr = RGB(r, g, b)
    End If
    Set src = Application.ThisCell
    sht = src.Parent.Name
    f = "Changeit(""" & sht & """,""" & _
                  src.Address(False, False) & """," & clr & ")"
    src.Parent.Evaluate f
    bgRGB = ""
End Function
页: [1]
查看完整版本: Excel VBA:单元格背景列