Excel:获取单元格颜色 [英] Excel: Get cell color
本文介绍了Excel:获取单元格颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
1)如何使用Excel宏获取单元格的颜色?我不能得到这个功能:
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) x,y我想要具有以下公式:
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 BGCol(MRow As Integer, MCol As Integer) As Integer
BGCol = Cells(MRow, MCol).Interior.ColorIndex
End Function
这篇关于Excel:获取单元格颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文