Hi guys,
I have made a script that change color on fonts and cell foreground,
now is my problem
I need to clear all cells with fontcolor 3=red from contents
so they are empty
I dont get it work
Could someone help me?
See code below
I have made a script that change color on fonts and cell foreground,
now is my problem
I need to clear all cells with fontcolor 3=red from contents
so they are empty
I dont get it work
Could someone help me?
See code below
Code:
Sub sheofs()
For Each sht In ActiveWorkbook.Worksheets
Set rng = sht.UsedRange
Set MyRange = rng
'Rows(1).Interior.Color = vbBlue
'Rows(1).Font.Color = vbRed
For Each MyCol In MyRange.Columns
For Each myCell In MyCol.Cells
If myCell.Interior.ColorIndex = 23 Then
myCell.Font.ColorIndex = 3
Cells(myCell.Row, 2).Copy
myCell.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End If
' I tried this
'If myCell.Font.ColorIndex = 1 Then
'myCell.Clearcontents
'End If
'
'I have also tried this
'
'If Mycell.Interior.ColorIndex = xlNone Then
'Mycell.ClearContents
'
'End If
'
'
Next
Next
Next
End Sub
Last edited: