Excel planilha vba datas usf dia mes ano

Qua, 13 de Abril de 2011 10:18 Expedito Marcondes
Imprimir

Saberexcel - o site de quem precisa Aprender Micrososft Excel VBA

Esse procedimento do Aplicativo Microsoft Excel VBA(Visual Basic Application), formata uma data em célula com auxílio de um objeto CommandButton.

.Value = Left(UCase(MonthName(Month(Date) - 1)), 4) & " " & Year(Date) 'quatro letras 'MARÇ'
.Value = UCase(MonthName(Month(Date) - 1)) & " " & Year(Date)
.Value = UCase(MonthName(Month(Date) - 1, True)) & " " & Year(Date)
.Value = DateSerial(Year(Date), Month(Date), -1)

Private Sub CommandButton1_Click()
If Day(Date) = 11 Then Rows("9").Insert xlShiftDown: Range("G9").Value = Month(Date)

ActiveCell.Value = Application.WorksheetFunction.Proper(ActiveCell.Value)
With Range("G9") '.
    With .Font
        .Bold = True ' teste negrito
        .Name = "Arial"
        .Size = 18
    End With

  'PODERÁ USAR UMA DAS FORMATAÇÕES ABAIXO
    '.Value = DateSerial(Year(Date), Month(Date), -1)
    '.Value = UCase(MonthName(Month(Date) - 1, True)) & " " & Year(Date)
    '.Value = UCase(MonthName(Month(Date) - 1)) & " " & Year(Date)
     .Value = Left(UCase(MonthName(Month(Date) - 1)), 4) & " " & Year(Date) 'quatro letras 'MARÇ'
     .NumberFormat = "mmm - yyyy"
End With

End Sub


Aprenda tudo sobre planilhas do Aplicativo Microsoft Excel VBA(Visual Basic Application), sozinho, com baixo custo, praticando com os produtos didáticos Saberexcel




  Baixe o exemplo de planiha contendo o procedimento acima
Excel planilha vba datas usf dia mes ano (68.35 KB)



Publicidade
Compre com segurança, garantia e ótimos preços
Eletrônicos - Submarino.com.br

Tags:
Última atualização em Sáb, 13 de Agosto de 2011 17:35