我的桌子上有一些彩色的单元格。我需要将它们的值复制到另一列。这是我的宏:
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
我正在尝试寻找另一种方法来复制彩色单元格的值。现在我正在尝试做:
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
这就是我需要的: