Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-29-2023, 06:48 AM
Marcia's Avatar
Marcia Marcia is offline Select fill colors in a workbook, change to another color Windows 11 Select fill colors in a workbook, change to another color Office 2021
Expert
Select fill colors in a workbook, change to another color
 
Join Date: May 2018
Location: Philippines
Posts: 553
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Select and Change Color with Keyboard Shortcuts? abrogard Word 12 06-04-2022 12:18 PM
Allow Cell Background Fill/Text Color Change while Protected Sheets are Grouped RaudelJr Excel 5 04-18-2017 11:11 PM
Select fill colors in a workbook, change to another color Change accent theme color used as shape fill (not RGBs) preetidb PowerPoint 4 12-30-2013 03:22 PM
Select fill colors in a workbook, change to another color Select a range in one one workbook while working in other workbook Slow&Steady Excel 1 02-21-2010 03:34 AM
Select fill colors in a workbook, change to another color Change Automatic Fill Color Leanne PowerPoint 1 11-04-2009 08:34 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft