Get Cell Color Function Function returns the active cell interior or font color index, regardless of whether it was set by regular or Conditional Formatting.
打开VBA编辑器: 按下ALT + F11 键,打开VBA编辑器。 插入模块: 在VBA编辑器中,点击“插入”菜单,选择“模块”,这将创建一个新的模块窗口。 编写VBA代码: 在模块窗口中编写VBA代码,使用 GET.CELL 函数来获取单元格的填充颜色。例如: vba Sub GetCellColor() Dim cellColor As Long cellColor = Application....
比如,用的最多的是Get.Cell。 我们怎么使用呢? 这个Get.Cell是用来返回一个单元格的各种属性的,它有两个参数,一个是属性代码,另外一个是单元格,比如Get.Cell(63,Sheet1!A1)就是返回Sheet1的A1单元格的填充颜色代码的。 比如,在宏表的A1单元格中输入公式: =FORMULA(GET.CELL(63,Sheet1!A1),Sheet1!C1) ...
1、在名称管理器中添加该函数,注意引用位置“=GET.CELL(63,Sheet1!B1)”中单元格要用相对引用,这样...
首先,选中 A 列, Ctrl+F3 新建名称 名称 可随便输入一个名称, 如示例 名称: 背景色 引用位置输入公式: =get.cell(63,Sheet2!$A1)(Sheet2!A1 为当前工作表 的A1单元格, 需依照 实际填写)点击 确定完成 新建名称。在B1 单元格输入 公式 =背景色 并下拉填充公式 如下图 结果 ...
Next icell 2.根据颜色计数代码 Application.Volatile For Each i In ary2 If i.Interior.ColorIndex = ary1.Interior.ColorIndex Then CountColor = CountColor + 1 End If Next 想要使用这两个代码,我们就必须先将其粘贴进vba中,首先我们点击开发工具,选择visual basic,进入vba的编辑界面,然后点击插入,...
6、.Colorlndex = col.Font.Colorindex ThenSumfontcolor = Application.Sum(icell) + SumfontcolorEnd IfNext icellEnd Function1、建立Excel对象set objExcelApp =Createobject(”Excel. Application”)不显示警不显示界objExcelApp.DisplayAlerts = false告.objExcelApp.Application.Visible = false面2、新建Excel...
Set currCell = .Range("I" & .Rows.Count).End(xlUp).Offset(1) currCell.Clear currCell.Value = "RGB(" & r & ", " & g & "," & b & ")" currCell.Interior.color = RGB(r, g, b) If GetContrastColor(currCell.Interior.color) = vbBlack Then ...
1、电脑打开要获取单元格颜色的表格。2、打开表格后,Alt+F11进入宏,点击插入模块。3、点击插入模块后输入代码 Function SUMColor(rag1 As Range, rag2 As Range)Application.Volatile For Each i In rag2 If i.Interior.ColorIndex = rag1.Interior.ColorIndex Then SUMColor = SUMColor + 1 End ...
使用VBA,看起来是通过循环的方式提取的 贴个函数,更具体的可以参考https://www.extendoffice.com/zh-CN/documents/excel/2234-excel-extract-cell-color.html Function GetColorText(pRange As Range) As String 'Updateby20141105 Dim xOut As String ...