Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / February 2007

Tip: Looking for answers? Try searching our database.

change all of the same fill colors in a worksheet

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bobt - 25 Feb 2007 11:16 GMT
I like to try various fill colors in presentations.  Can I change all of the
same fill colors in aworksheet at the same time?
MartinW - 25 Feb 2007 12:22 GMT
Hi Bob,

It's not very elegant but you can do a global change by
going to Tools>Options>Color Tab then click on a color
square and click modify. This will change any cell using that
tab to whatever you like.

There is probably a way to pre-set this sort of funcionality
with VBA but it would need to be something that is set up
for your individual needs rather than a cure-all that will work
in any situation.

I know virtually nothing about VBA but it might be worth
posting a question in the programming newsgroup.

HTH
Martin
Bob Phillips - 25 Feb 2007 13:44 GMT
Here is code to follow that route

Sub Macro1()
Dim iOldCI As Long
Dim iNewCI As Long
   With ActiveCell.Interior
       If .ColorIndex <> xlColorIndexNone Then
           iOldCI = .Color
           ActiveWorkbook.Colors(.ColorIndex) = GetColor()
       End If
   End With
End Sub

'-----------------------------­------------------------------­--------------
Function GetColor(Optional Text As Boolean = False) As Long
'-----------------------------­------------------------------­--------------
Dim rngCurr As Range
Dim prev As Worksheet
Dim sh As Worksheet
   Set prev = ActiveWorkbook.ActiveSheet
   Set rngCurr = Selection
   Set sh = ActiveWorkbook.Worksheets.Add
   Application.ScreenUpdating = False
   With sh
       .Range("IV1").Select
       Application.Dialogs(xlDialogPatterns).Show
       GetColor = ActiveCell.Interior.Color
       If GetColor = xlColorIndexAutomatic And Not Text Then
           GetColor = xlColorIndexNone
       End If
       ActiveCell.Interior.ColorIndex = xlColorIndexAutomatic
       prev.Activate
       rngCurr.Select
       Set rngCurr = ActiveSheet.UsedRange
   End With
   Application.DisplayAlerts = False
   sh.Delete
   Application.DisplayAlerts = True
   Application.ScreenUpdating = True
End Function

> Hi Bob,
>
[quoted text clipped - 13 lines]
> HTH
> Martin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.