Excel: Get cell color

前端 未结 3 1123
野的像风
野的像风 2021-01-06 03:30

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(M         


        
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-06 04:11

    You should use a Function:

    Function BGCol(MRow As Integer, MCol As Integer)  As Integer
       BGCol = Cells(MRow, MCol).Interior.ColorIndex  
    End Function
    

提交回复
热议问题