View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default VBA ColorIndex Formatting

Are you trying to remove that formatting from cells that have both
..interior.colorindex = 1
and
..font.strikethrough = true

Option Explicit
Sub testme01()
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
With wks
Application.FindFormat.Clear
With Application.FindFormat
.Font.Strikethrough = True
.Interior.ColorIndex = 6
End With
With Application.ReplaceFormat
.Font.Strikethrough = False
.Interior.ColorIndex = xlNone
End With
.Cells.Replace What:="", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=True, _
ReplaceFormat:=True
End With
Next wks
End Sub

And I wouldn't replace "" with " ". I'd just use "" with "".

wrote:

This worked really well, it now handles all worksheets with cells that
a colorindex =1.

However, I originally had code that replaced all font = strikethrough
with " ", this code no longer works. It appears that VBA will only
allow me to do one replace, either colorindex = 1 to xlnone or
strikethrough with blank.

I've tried placing the replace strikethrough code with the colorindex
code and that didn't work, I even tried creating a new sub routine but
that didn't work.

Any suggestions on this??

Robin


--

Dave Peterson