change the color of the font & borders

This is a discussion on change the color of the font & borders within the Excel Questions forums, part of the Question Forums category; Ok, I am trying to do a work around. I want a macro that selects an area, I want the ...

change the color of the font & borders

Ok, I am trying to do a work around. I want a macro that selects an area, I want the macro to change any font that is not the default (black, color index 0) to change it to white (color index 2) so it doesn't show up when it prints. Then at the end of the macro I will change it back all the white fonts to a different color.......Below is the simple macro that I wrote, but doesn't seem to work......perhaps some of you gurus can help me out...

Range("B3:G11").Select
If Selection.Font.ColorIndex <> 0 Then

With Selection.Font
.ColorIndex = 2
End With
End If

End Sub

Now there is one more piece of the puzzle that I am not sure where to even start. Same thing as above, but I want to also change any borders that are not the default color to white also, so they do not show up when printed either.......

Re: change the color of the font & borders

Not quite, but I have been playing with it, but can't get it to want I want........basically everything in the area that is not the default color of 0 (black) I want it to change to white (2) ....font & borders, even if the borders are around a cell that contains black font, as long as the border is not black.

Re: change the color of the font & borders

Range("A1:I62").Select
For Each cell In [A1:I62]
If cell.Font.ColorIndex > 0 Then cell.Font.ColorIndex = 2
Next cell
For Each cell In [A1:I62]
If cell.Borders.LineStyle > 0 Then cell.Borders.LineStyle = 2
Next cell
For Each cell In [A1:I62]
'If cell.Font.ColorIndex > 0 Then cell.Borders.LineStyle = 0
If cell.Borders(xlEdgeTop).ColorIndex > 0 Then cell.Borders.ColorIndex = 2
If cell.Borders(xlEdgeBottom).ColorIndex > 0 Then cell.Borders.ColorIndex = 2
If cell.Borders(xlEdgeRight).ColorIndex > 0 Then cell.Borders.ColorIndex = 2
If cell.Borders(xlEdgeLeft).ColorIndex > 0 Then cell.Borders.ColorIndex = 2
Next cell
' print the file (insert form in paper tray here)

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

' reset all the now white font & borders to gray for next use

Range("A1:I62").Select
For Each cell In [A1:I62]
If cell.Font.ColorIndex = 2 Then cell.Font.ColorIndex = 16
Next cell
For Each cell In [A1:I62]
If cell.Borders.LineStyle = 2 Then cell.Borders.LineStyle = 16
Next cell