Blog Archive

About Me

A minha foto
JRod - PORTUGAL
Microsoft [MVP] - Excel (10º ano consecutivo)
Ver o meu perfil completo
Com tecnologia do Blogger.

Seguidores

Estatisticas

Free Blog Counter

eXTReMe Tracker
2004-11-30
Exemplo de procedimento para formatação de células a BOLD, se estas contiverem valores negativos:

Sub BoldNegative()
Sheets("Hard_Bill").SelectColumns("E:E").Select
On Error Resume Next
Call CheckCells(Selection.SpecialCells(xlConstants, 23))
Call CheckCells(Selection.SpecialCells(xlFormulas, 23))
Columns("H:H").Select
On Error Resume Next
Call CheckCells(Selection.SpecialCells(xlConstants, 23))
Call CheckCells(Selection.SpecialCells(xlFormulas, 23))
Range("a1").Select
End Sub

Sub CheckCells(CurrRange As Range)
For Each cell In CurrRange
If cell.Value <>
cell.Font.Bold = True
With cell.Interior.ColorIndex = 5.Pattern = xlSolid
End With
End If
If cell.Value >= 0 Then
cell.Font.Bold = False
Selection.Interior.ColorIndex = 0
End If
Next cell
End Sub