我有桌子,有一些细胞着色。我需要将它们的值复制到另一列。这是我的宏:
Sub exa()
Dim rng As Range
Dim row As Range
Dim cell As Range
Set rng = Range("B:AJ")
For Each row In rng.Rows
For Each (cell).Interior.Color = RGB(138, 255, 132) in row.Cells
Area.Offset(, 40).Value = Area.Value
Next cell
Next row
End Sub
我正在尝试找到另一种复制collorized细胞值的方法。现在我想做:
Sub test()
Dim rng As Range
Dim r As Integer
Set rng = ActiveSheet.Range("B2:I8")
For Each Row In rng.Rows
For Each cell In Row.Cells
If cell.Interior.Color = RGB(138, 255, 132) Then
' cell.Copy Destination:=Sheets("HMPB").Range("AU")
Area.Offset(, 40).Value = Area.Value
Next cell
Next Row
End Sub
字符串
有问题(cell).Interior.Color = RGB(138, 255, 132) in row.Cells
这就是我需要的:
答案 0 :(得分:1)
要获得有关颜色的代码:
For Each row In rng.Rows
For Each cell In row.cells
cell.Interior.Color = RGB(138, 255, 132)
Next cell
Next row
为了获得您需要的效果,方法可能会有所不同。但是,我不确定这是否是您问题的一部分。