About Me
Com tecnologia do Blogger.
Seguidores
Estatisticas
2005-07-26
Se pretendermos que, em determinada coluna, os números negativos sejam apresentados a BOLD, como no exemplo,


podemos utilizar um pouco de VBA.
O Código:
Private Sub CommandButton1_Click()
Sheets("Sheet1").Select
Columns("A:A").Select
On Error Resume Next
Call CheckCells(Selection.SpecialCells(xlConstants, 23))
Call CheckCells(Selection.SpecialCells(xlFormulas, 23))
Range("b1").Select
End Sub
Sub CheckCells(CurrRange As Range)
For Each cell In CurrRange
If cell.Value < 0 Then
cell.Font.Bold = True
End If
If cell.Value >= 0 Then
cell.Font.Bold = False
Selection.Interior.ColorIndex = 0
End If
Next cell
End Sub
podemos utilizar um pouco de VBA.
O Código:
Private Sub CommandButton1_Click()
Sheets("Sheet1").Select
Columns("A:A").Select
On Error Resume Next
Call CheckCells(Selection.SpecialCells(xlConstants, 23))
Call CheckCells(Selection.SpecialCells(xlFormulas, 23))
Range("b1").Select
End Sub
Sub CheckCells(CurrRange As Range)
For Each cell In CurrRange
If cell.Value < 0 Then
cell.Font.Bold = True
End If
If cell.Value >= 0 Then
cell.Font.Bold = False
Selection.Interior.ColorIndex = 0
End If
Next cell
End Sub