I've trying to create a macro that changes all the grey cells to yellow cells. I've created a code that I think should work but it doesn't and I can't find what I've done wrong.
Any help would be greatly appreciated. The document I want to change the cells colors in has some merged cells that why I have the extra functions in the bottom of the code.

Sub colorchange()
    Dim c As Range
    Dim myMergedrange As Range
    Dim iColorIndex As Integer
    Dim ws As Worksheet
    Dim sht As Variant
    
        For Each ws In Sheets
            ws.Activate
            ActiveSheet.Unprotect
              
    For Each c In ActiveSheet.UsedRange
        iColorIndex = c.Interior.ColorIndex
        
            If Ismerged(c) = True Then
                If IsTopleftcellOfMergedRange(c) Then
                  myMergedrange = c.MergeArea
                End If
                If iColorIndex = 15 Then
                   iColorIndex = 36
                End If
            Else
                If iColorIndex = 15 Then
                   iColorIndex = 36
                End If
            End If
    
    Next c
'Clear Object pointer


    Set myMergedrange = Nothing
    
       
    
    Next ws

        
End Sub


Function Ismerged(rCell As Range) As Boolean
    'Returns True if input cell ist part of the 'Merged cell'
    Ismerged = rCell.MergeCells
End Function

Function IsTopleftcellOfMergedRange(rCell As Range) As Boolean
    'Returns True if the input cell is the 'top left' cell of a 'merged cell'
    Dim r As Range
    Dim rstart As Range
    
    'Only process if the input cell is part of a 'merged cell'
    If Ismerged(rCell) = True Then
        
        'Get the 'top left' cell of the 'Merged Area'
        Set r = rCell.MergeArea
        Set rstart = r.Cells(1, 1)
        
        'Return True if this Cell is the 'Top left' cell
        If rstart.Address = rCell.Address Then
            IsTopleftcellOfMergedRange = True
        End If
        
        'Clear range objects
        Set r = Nothing
        Set rstart = Nothing
    End If

End Function
Best Regards
Lars