我希望有人可以提供帮助 - 我已经把头发撕了好几个小时了。因此,我尝试根据该单元格中文本的颜色向单元格添加变量图形。例如:
因此,例如,如果它是超级轮胎,则需要将1.9添加到粉红色时间。在D2 83.229将成为85.129。如果它是超级(红色),则需要将1.4添加到D18。
我相信通过名称管理器可能有一种方法,但无法加入点以使其工作。
答案 0 :(得分:0)
看起来最简单的方法就是做一个vlookup。更多病态的好奇心。
答案 1 :(得分:0)
根据您的样本布局,可以从'键中选择每种字体颜色。或图例并通过AutoFilter method应用于数据块。如果在应用滤镜后可以找到可见数字,Range.PasteSpecial method可以将与颜色关联的金额添加到时间列。
Sub coloredTyres()
Dim clr As Long, rng As Variant
With Worksheets("Tyres")
If .AutoFilterMode Then .AutoFilterMode = False
With .Cells(1, 1).CurrentRegion
For Each rng In .Parent.Range(.Cells(2, "H"), .Cells(2, "H").End(xlToRight))
.AutoFilter Field:=3, Criteria1:=rng.Font.Color, _
Operator:=xlFilterFontColor
If CBool(Application.Subtotal(102, .Columns(4))) Then
rng.Offset(1, 0).Copy
With Intersect(.Columns(4), _
.SpecialCells(xlCellTypeVisible), _
.SpecialCells(xlCellTypeConstants, xlNumbers))
.PasteSpecial Paste:=xlValues, operation:=xlPasteSpecialOperationAdd
End With
End If
.AutoFilter Field:=3
Next rng
End With
If .AutoFilterMode Then .AutoFilterMode = False
End With
End Sub
我已经在一些随机数据上对此进行了测试,但我不打算将整个样本图像重新输入。