terça-feira, 29 de julho de 2008

Converte em maiúscula

Navegando pela net achei (adaptei) um codigo que converte o texto de uma planilha para maiúsculo.


Sub maiusculo()
Application.ScreenUpdating = False
Dim Planilha As Worksheet
Dim Contador As Long
Dim Célula As Range
Set Planilha = ThisWorkbook.ActiveSheet
Contador = 0
If IsEmpty(Planilha.UsedRange.Cells) = True Then
MsgBox "Nao há nada para converter para maiúscula na planilha de nome: " _ & Planilha.Name, vbInformation, "Nada para converter..."
Exit Sub
End If
For Each Célula In Planilha.UsedRange.Cells
If Célula.Formula <> "" Then
Célula.Formula = UCase(Célula.Formula)
Contador = Contador + 1
End If
Next Célula
Application.ScreenUpdating = True
End Sub

Nenhum comentário:

Google