Hi all,
i have been trying to change cell background color using following code but it's not been working. please help me to fix this problem.
Function ChangeColor(rng As Range, rngcolor As Range)
Dim cell As Range
Dim cellcolor As Long
cellcolor = rngcolor.Range("a1").Interior.ColorIndex
For Each cell In rng
If cell.Interior.Color = vbWhite Then
cell.Interior.ColorIndex = cellcolor
End If
Next cell
End Function
thanks in advance
i have been trying to change cell background color using following code but it's not been working. please help me to fix this problem.
Function ChangeColor(rng As Range, rngcolor As Range)
Dim cell As Range
Dim cellcolor As Long
cellcolor = rngcolor.Range("a1").Interior.ColorIndex
For Each cell In rng
If cell.Interior.Color = vbWhite Then
cell.Interior.ColorIndex = cellcolor
End If
Next cell
End Function
thanks in advance