Descricao: |
Saberexcel - o site de quem precisa aprender Macros Microsoft Excel VBA
![](/images/stories/excel/linazul.jpg) Essa macros do Aplicativo Microsoft Excel VBA (Visual Basic Application) contém intrução for each next converte os valores de reais em euros, e retorna uma mensagem do valor da conversão referente a um programa de treinamento Curso Completo Microsoft Excel VBA.
Esse exemplo faz parte do MODULO treinamento com loops - 100 Planilhas com loops TREINAMENTOS COM LOOPS - ESCOLA SABEREXCEL VBA ESTUDOS - TREINAMENTOS COM MACROS FÓRMULAS E FUNÇÕES. 100 PLANILHAS COM EXERCÍCIOS LOOPS - \ While...Wend \ Do...While...Loop \ Do...Loop...While \ Do...until..Loop \ Do...Loop...until \ For...Next\ For...Each...Next
Sub Converter_reais_em_Euro() [f2].Select Set Area = Selection 'Plan1.[f2]
For Each Cell In Area sbx = Round(Cell / [F1].Value, 3) Cell.Offset(1, 0).Value = sbx Cell.NumberFormat = "#,##0.00" Next Cell
MsgBox ("Valor do Curso Completo Microsoft Excel") & vbCrLf & _ "Escola Saberexcel VBA Estudos - Treinamento Macros, " & _ "são: [ " & Format([f3].Value, "##,####.00" & "€ ] "), vbInformation, "Saberexcel - o site das macros" [B1].Select End Sub
Sub Converter_reais_em_Euro_1() [vl].Select 'celulas renomeadas como (vl) Saber2.[g1].Value = Saber2.[ve].Value Set Area = Selection 'Plan1.[f2]
'fazendo um loop por toda as células selecionadas(vl) For Each Cell In Area sbx = Round(Cell / [g1].Value, 3) Cell.Offset(0, 2).Value = sbx 'deslocando duas colunas à direita Cell.NumberFormat = "$ #,##0.00" Next Cell
'somando valores usando Função de planilha WorksheetFunction(Soma) 'temos 340 planihas exercícios com WorksheetFunctions(VBA) uma para cada função do excel Saber2.Range("g1") = Application.WorksheetFunction.Sum(Saber2.Range("ve")) Saber2.Range("g2") = Application.WorksheetFunction.Sum(Saber2.Range("vle")) Saber2.Range("g3") = Application.WorksheetFunction.Sum(Saber2.Range("vl"))
'mensagem concatenando os valores MsgBox ("Valores em reais convertidos em Euros") & vbCrLf & _ "Escola Saberexcel VBA Estudos - Treinamento Macros, " & _ "são: [ " & Format([g2].Value, "##,####.00" & "€ ] "), vbInformation, "Saberexcel - o site das macros" [B1].Select End Sub
Sub limpar_teste() [g1,g2,g3,vle].ClearContents End Sub
![](/images/stories/excel/linazul.jpg) Aprenda tudo sobre planilhas do Aplicativo Microsoft Excel VBA(Visual Basic Application), sozinho, com baixo custo, praticando com os produtos didáticos Escola Saberexcel VBA Estudos® - Treinamentos com Macros, Fórmulas e Funções.
![](/images/stories/jm_produtos.jpg)
|