Descricao: |
Saberexcel - o site de quem precisa aprender Microsoft Excel VBA
 Essa macro do Aplicativo Microsoift Excel VBA(Visual Basic Application), insere uma soma na coluna(G), e desloca até a última celula usada, desloca mais uma e insere a FORMULA '=SUBTOTAL(9;G$2:DESLOC(G7;-1;0))', somando o total de números inseridos nesta coluna. Espero que o exemplo seja útil. Fique com Deus, Expedito Marcondes.
Sub Inserindo_SubTotal_Coluna() Dim vFinalDados As Long
[G1].Select Range(ActiveCell.Address, _ Cells(Rows.Count, ActiveCell.Column).End(xlUp).Address).Select
vFinalDados = ActiveSheet.Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row
ActiveSheet.Cells(vFinalDados + 1, ActiveCell.Column).Formula = _ "=SUBTOTAL(9," & ActiveSheet.Cells(2, ActiveCell.Column).Address(1, 0) _ & ":OFFSET(" & ActiveSheet.Cells(vFinalDados + 1, _ ActiveCell.Column).Address(0, 0) & ",-1,0))"
[H1].Select
End Sub
Sub Deleta_Celula_formulas() On Error GoTo sbError [G1:G100].SpecialCells(xlFormulas, 23).ClearContents Exit Sub sbError: MsgBox ("Não há fórmulas para serem apagadas,execute o macro para inserir"), vbInformation, "Saberexcel - site das macros" 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

Publicidade Compre com segurança, garantia e ótimos preços

|