I wrote the macro below to record information in Column H, regarding the colors used in the Column A thru G cells of the selected row.
ie: (3,1)8 (3,2)8 (3,3)8 (3,4)45 (3,5)6 (3,6)6 (3,7)3
I need code to restore the colors using that information.
A sample workbook is attached.
[vba]
Private Sub CommandButton1_Click()
'Column H used to save the color index & cell location for each cell in active row
Dim TheRow As Range
Dim cll As Range, CellColorsInRow As String
Set TheRow = ActiveCell.EntireRow.Cells(1).Resize(, 7)
ActiveCell.EntireRow.Cells(8).ClearContents
If ActiveCell.Row > 1 And Selection.Rows.Count = 1 Then
For Each cll In TheRow
If cll.Interior.ColorIndex > 0 Then
CellColorsInRow = CellColorsInRow & _
" (" & cll.Row & "," & cll.Column & ")" & cll.Interior.ColorIndex
End If
Next cll
End If
ActiveCell.EntireRow.Cells(8).Value = CellColorsInRow
TheRow.Interior.ColorIndex = xlNone
End Sub
[/vba]