View Single Post
 
Old 01-29-2023, 06:48 AM
Marcia's Avatar
Marcia Marcia is offline Windows 11 Office 2021
Expert
 
Join Date: May 2018
Location: Philippines
Posts: 527
Marcia has a spectacular aura aboutMarcia has a spectacular aura aboutMarcia has a spectacular aura about
Default

Quote:
Originally Posted by Guessed View Post
It would be a lot faster to customise the color palette and apply that to your cells. In the future you just change the color in the palette.

This macro has two parts. The first part is searching all cells to find the RGB values and assign the first accent color. The final line changes the accent color in the palette.
Code:
Sub RecolorMe()
  Dim iCol As Long, aCell As Range, aWS As Worksheet
  For Each aWS In ActiveWorkbook.Sheets
    For Each aCell In aWS.UsedRange.Cells
      If aCell.Interior.Color = RGB(220, 230, 241) Then
        aCell.Interior.ThemeColor = xlThemeColorAccent1
      End If
    Next aCell
  Next aWS
  
  'Change the theme color
  ActiveWorkbook.Theme.ThemeColorScheme.Colors(msoThemeAccent1) = RGB(253, 233, 217)
End Sub
Andrew, I tried this code and it works but it keeps on running unless Esc is pressed. A debug error appears on the "End If" line. Thank you.

Last edited by Marcia; 01-29-2023 at 06:52 PM.
Reply With Quote