Good evening,

I have a column C3 in which I enter a value and a range (BU:CI) in which I also enter a value for each column.

For each row (10000) I would like a macro to copy the formtting ( interior and font ) of C3 value if this value is the same in the Range (BU:CI)

I have tried to write the following code. It works for the first one but when I add to it does not work any longer.

Could you please help?

Thanks in advance

Bruno

Private Sub CommandButton1_Click()

Dim i As Integer

For i = 3 To 10000

If Cells(i, 3).Value = Cells(i, 73).Value Then

Cells(i, 73).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 73).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 74).Value Then

Cells(i, 74).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 74).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 75).Value Then

Cells(i, 75).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 75).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 76).Value Then

Cells(i, 76).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 76).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 77).Value Then

Cells(i, 77).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 77).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 78).Value Then

Cells(i, 78).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 78).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 79).Value Then

Cells(i, 79).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 79).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 80).Value Then

Cells(i, 80).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 80).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 81).Value Then

Cells(i, 81).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 81).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 82).Value Then

Cells(i, 82).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 82).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 82).Value Then

Cells(i, 83).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 83).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 82).Value Then

Cells(i, 84).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 84).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 85).Value Then

Cells(i, 85).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 85).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 86).Value Then

Cells(i, 86).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 86).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 87).Value Then

Cells(i, 87).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 87).Font.Color = Cells(i, 3).Font.Color

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

Next i

End Sub

I have a column C3 in which I enter a value and a range (BU:CI) in which I also enter a value for each column.

For each row (10000) I would like a macro to copy the formtting ( interior and font ) of C3 value if this value is the same in the Range (BU:CI)

I have tried to write the following code. It works for the first one but when I add to it does not work any longer.

Could you please help?

Thanks in advance

Bruno

Private Sub CommandButton1_Click()

Dim i As Integer

For i = 3 To 10000

If Cells(i, 3).Value = Cells(i, 73).Value Then

Cells(i, 73).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 73).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 74).Value Then

Cells(i, 74).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 74).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 75).Value Then

Cells(i, 75).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 75).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 76).Value Then

Cells(i, 76).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 76).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 77).Value Then

Cells(i, 77).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 77).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 78).Value Then

Cells(i, 78).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 78).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 79).Value Then

Cells(i, 79).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 79).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 80).Value Then

Cells(i, 80).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 80).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 81).Value Then

Cells(i, 81).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 81).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 82).Value Then

Cells(i, 82).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 82).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 82).Value Then

Cells(i, 83).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 83).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 82).Value Then

Cells(i, 84).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 84).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 85).Value Then

Cells(i, 85).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 85).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 86).Value Then

Cells(i, 86).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 86).Font.Color = Cells(i, 3).Font.Color

If Cells(i, 3).Value = Cells(i, 87).Value Then

Cells(i, 87).Interior.ColorIndex = Cells(i, 3).Interior.ColorIndex

Cells(i, 87).Font.Color = Cells(i, 3).Font.Color

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

Next i

End Sub

Last edited: