ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB Question (https://www.excelbanter.com/excel-programming/433251-vbulletin-question.html)

Drew

VB Question
 
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!
--
Drew

Patrick Molloy[_2_]

VB Question
 
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

"Drew" wrote:

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!
--
Drew


JLatham

VB Question
 
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.

"Patrick Molloy" wrote:

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

"Drew" wrote:

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!
--
Drew


Patrick Molloy[_2_]

VB Question
 
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

"JLatham" wrote:

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.

"Patrick Molloy" wrote:

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

"Drew" wrote:

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!
--
Drew



All times are GMT +1. The time now is 03:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com