Sub somar() Dim soma As Double soma = Application.WorksheetFunction.Sum(Range("A1:A10")) MsgBox "A soma dos valores é: " & soma End Sub
Sub formatar() Range("A1:A10").NumberFormat = "R$ #,##0.00" End Sub
Sub ordenar() Range("A1:H10").Sort Key1:=Range("B1"), Order1:=xlDescending, Header:=xlYes End Sub
Sub proteger() ActiveSheet.Protect Password:="senha", UserInterfaceOnly:=True End Sub
Sub tabela_dinamica() Dim pt As PivotTable Set pt = ActiveSheet.PivotTableWizard(TableDestination:=Range("A1"), _ SourceType:=xlDatabase, SourceData:=Range("A1:H10"), _ TableStyleName:="PivotStyleLight8") End Sub