4
1)如何使用Excel宏获取单元格的颜色?我不能让此功能工作:Excel:获取单元格颜色
Sub BGCol(MRow As Integer, MCol As Integer)
bgColor = Cells(MRow, MCol).Interior.ColorIndex
End Sub
2)在细胞中的x,y我想有以下公式:
=BGCol(x,4)
那么,如何让当前行的索引?
1)如何使用Excel宏获取单元格的颜色?我不能让此功能工作:Excel:获取单元格颜色
Sub BGCol(MRow As Integer, MCol As Integer)
bgColor = Cells(MRow, MCol).Interior.ColorIndex
End Sub
2)在细胞中的x,y我想有以下公式:
=BGCol(x,4)
那么,如何让当前行的索引?
你应该使用一个功能:
Function BGCol(MRow As Integer, MCol As Integer) As Integer
BGCol = Cells(MRow, MCol).Interior.ColorIndex
End Function
Function GetColor(Mycell As Range)
GetColor = Mycell.Interior.ColorIndex
End Function
:::使用公式:: = GETCOLOR(X4)
谢谢,这个工作,但在公式中如何使用呢?我还想获得当前行号,例如= BGCol(x,4) – Caner
使用行()作为行(意外)。 –