Format fill colour based on another cell
Solved/Closed
                    
        
                    EndlessDread
    
        
                    Posts
            
                
            2
                
                            Registration date
            Monday June 30, 2014
                            Status
            Member
                            Last seen
            July  2, 2014
            
                -
                            Jun 30, 2014 at 03:10 PM
                        
EndlessDread Posts 2 Registration date Monday June 30, 2014 Status Member Last seen July 2, 2014 - Jul 2, 2014 at 02:01 PM
        EndlessDread Posts 2 Registration date Monday June 30, 2014 Status Member Last seen July 2, 2014 - Jul 2, 2014 at 02:01 PM
        Related:         
- Excel change text color based on value of another cell
 - Excel cell color formula - Guide
 - Notepad++ change background color - Guide
 - How to change text color in html - Guide
 - Color 65535 - Guide
 - Excel mod apk for pc - Download - Spreadsheets
 
1 response
                
        
                    TrowaD
    
        
                    Posts
            
                
            2921
                
                            Registration date
            Sunday September 12, 2010
                            Status
            Contributor
                            Last seen
            December 27, 2022
            
            
                    555
    
    
                    
Jul 1, 2014 at 11:40 AM
    Jul 1, 2014 at 11:40 AM
                        
                    Hi EndlessDread,
Your explanation doesn't match your pic. I assumed that the A column had to be the F column.
Give this code a try:
Best regards,
Trowa
 
Monday, Tuesday and Thursday are usually the days I'll respond. Bear this in mind when awaiting a reply.
            Your explanation doesn't match your pic. I assumed that the A column had to be the F column.
Give this code a try:
Sub RunMe()
Dim lRow As Long
lRow = Range("F1").End(xlDown).Row
Range("A1:F1").Interior.ColorIndex = 5
For Each cell In Range("F2:F" & lRow)
    If cell.Value = cell.Offset(-1, 0).Value Then
        Range(Cells(cell.Row, "A"), Cells(cell.Row, "F")).Interior.ColorIndex = cell.Offset(-1, 0).Interior.ColorIndex
    Else
        If cell.Offset(-1, 0).Interior.ColorIndex = 5 Then
            Range(Cells(cell.Row, "A"), Cells(cell.Row, "F")).Interior.ColorIndex = 8
        Else
            Range(Cells(cell.Row, "A"), Cells(cell.Row, "F")).Interior.ColorIndex = 5
        End If
    End If
Next cell
End Sub
Best regards,
Trowa
Monday, Tuesday and Thursday are usually the days I'll respond. Bear this in mind when awaiting a reply.
        
    
    
    
    

Jul 2, 2014 at 02:01 PM
And I'm sorry about the image, my excel file is complicated and in my attempt to simplify and cut it for this image I accidentally change the values. With only a minor change the code you gave me worked fine.
Thank you again