JakariKryze
New Member
- Joined
- Dec 14, 2021
- Messages
- 10
- Office Version
- 365
- Platform
- Windows
I need to get my code to Sum 2 columns on every Ws and if they are equal to each other change their fill color. i need to do this for 40 sheets but i have 3 sheets this doesnt need to happen for.
My current code only does the Sum for the active sheet i am on and i havent been able to get the color to work:
My current code only does the Sum for the active sheet i am on and i havent been able to get the color to work:
VBA Code:
Sub EveryDaySum()
Dim Ws As Worksheet
For Each Ws In Worksheets
Range("E1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[1]C:R[7]C)"
Range("J1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[1]C:R[2]C)"
If Cell.Value("E1") = ("J1") Then Range("E1,J1").Select
Range("J1").Activate
With Selection.Interior 'Color Yellow
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
Selection.Font.Bold = True
End With
End IF
Next Ws
End Sub