1) How do I get the color of a cell using an Excel Macro? I couldn't get this function work:
Sub BGCol(MRow As Integer, MCol As Integer)
bgColor = Cells(MRow, MCol).Interior.ColorIndex
End Sub
2) In the cell x,y I want to have the following formula:
=BGCol(x,4)
So how do I get the current row index?
Function GetColor(Mycell As Range)
GetColor = Mycell.Interior.ColorIndex
End Function
:::Use Formula:: =getcolor(x4)
You should use a Function:
Function BGCol(MRow As Integer, MCol As Integer) As Integer
BGCol = Cells(MRow, MCol).Interior.ColorIndex
End Function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With