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
使用行()作爲行(意外)。 –