VB Question

  • Thread starter Thread starter Drew
  • Start date Start date
D

Drew

I am a VB beginner and am looking for some code that I could use to change
cell shading from tan for all appliable cells in all of the worksheets to
blue font. Does anyone have a script that I could use?

Thank You!
 
switch on the macro recorder
then from the menu

Format / Styles / Modify / Patterns
choose a color
ok everythinmg then stop the recorder
look at the code
what you need will end up like this:

Sub Macro1()
With ActiveWorkbook.Styles("Normal").Interior
.ColorIndex = 36
.PatternColorIndex = xlAutomatic
.Pattern = xlSolid
End With
End Sub
 
Not faulting your code: but he seems to PERHAPS actually want to change font
to blue only in cells that have tan shading? Or maybe I'm reading too much
into his request.
 
no worries. I misunderstood the question

this code is perhaps what is required:

Option Explicit
Const cTAN As Long = 10079487
Sub Tan2Blue()
Dim cell As Range
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
Application.StatusBar = "checking " & ws.Name
For Each cell In ws.UsedRange.Cells
If cell.Interior.Color = cTAN Then
cell.Font.Color = vbBlue
End If
Next
Next
Application.StatusBar = False
Application.ScreenUpdating = True
End Sub
 
Back
Top