.Color = -16776961 .TintAndShade = 0 End With End If Next myCell End Sub The color value of your RGB values = 10284031 (i.e. the result of R+G*256+B*256*256). You need this to be able to read out color value in each of your cells....
Volatile For Each colorCell In rng If colorCell.Font.ColorIndex = color.Font.ColorIndex Then fcountCol = 1 + fcountCol End If Next End Function 查找单元格背景颜色自定义函数: Function fcountBGCol(color As Range, rng As Range) Application.Volatile For Each i In rng If i.Interior.color ...
Public Function ColorChange()For i = 2 To Cells(1000, 2).End(xlUp).RowIf Cells(i, 2).Interior.Color = 12611584 ThenColorChange = "配料"Exit FunctionEnd IfNextColorChange = ""End Function判断单元格的颜色,现在只能使用vba呢。函数不能判断单元格的颜色。用IF 判断啊
{"__typename":"ForumTopicMessage","uid":1147123,"subject":"Excel Macros If Function Based on Cell Color","id":"message:1147123","revisionNum":1,"repliesCount":4,"author":{"__ref":"User:user:542405"},"depth":0,"hasGivenKudo":false,"board":{"__ref":"Forum:board:ExcelGeneral"},...
方法/步骤 1 打开一个工作样表作为例子。如图所示:2 输入cell函数公式,并使用color参数。如图所示:3 cell函数公式的参数必须使用双引号包括。如图所示:4 这里我们可以查看e33的单元格格式中的颜色格式为负值显示为红色,与正数的黑色颜色不同,所以得值为1,如图所示:5 将单元格负数颜色修改为黑色后,得值为0...
输入公式“=SUMIF($B$11:$G$17,A19,$B$3:$G$9)”并下拉即可。 能去掉辅助行或列吗? 可以!只不过定义名称中的公式就复杂了。 2)复杂公式 步骤: (1)重新定义名称。 定义名称,新创建一个名称“color_2”,然后在引用位置输入如下公式: =SUM((GET.CELL(63,INDIRECT("r"&ROW(Sheet3!$B$3:$G$9)...
Function ConditionalColor(rg As Range, FormatType As String) As Long'Returns the color index (either font or interior) of the first cell in range rg. If no _conditional format conditions apply,Thenreturns the regular color of the cell. _ FormatTypeIseither "Font"Or"Interior" Dim cel As ...
Next icell End Function 2.根据颜色计数代码 Function CountColor(x As Range, ary2 As Range)Application.Volatile For Each i In ary2 If i.Interior.ColorIndex = x.Interior.ColorIndex Then CountColor = CountColor + 1 End If Next End Function 在这里我们定义了SumColor与CountColor两个自定义函数,SumC...
EachRgIn求和区域SelectCase颜色类型Case"填充"Bol = (Rg.Interior.Color = 参考单元格.Interior.Color)Case"字体"Bol = (Rg.Font.Color = 参考单元格.Font.Color)CaseElse按颜色求和 ="第三参数出错,请检查确认"ExitFunctionEndSelectIfBolThenTotal = Total + Rg.ValueEndIfNext按颜色求和 = TotalEndFunction...
1. 宏表函数因为是早期Excel函数,不能直接使用,要通过"名称"使用它 "插入"菜单-->名称-->定义-->上边输入定义名称名字color-->引用位置输入=GET.CELL(63,Sheet1!$A$1)+RAND()*0 -->然后,点右侧的"添加"按钮 2. B1输入公式=color, 此时B1的值就是A1单元格的背景颜色值。解释:a. GET...