
PROMOÇÃO ESPECIAL – EXCEL VBA Adquirir o Material Didático Escola SaberExcel VBA Estudos
Planilha Excel VBA calculos notas finais operadores or and Excelentes Exercícios Excel VBA Escola VBA – Escola Saberexcel
CALCULANDO NOTAS FINAIS – Este Macro do Aplicativo Microsoft Excel VBA(Visual Basic Application),
Esse exemplo de planilha usando as instruções For Next (Aninhada) para linhas e Colunas e condição IF juntamente com a condição ElseIF e Operadores And e Or (E, e OU), fazem os calculos de notas finais, observe que para cada folha de planilha existe a indagação, porque a folha de Planilha Matemática tem os calculos diferenciados das demais folhas de Planilhas, as Folhas de Planilhas “INGLES, ESTUDOS SOCIAIS, GEOMETRIA são simetricamente iguais para programaçao, ao passo que a folha de Planilha MATEMATICA É DIFERENTE.
Pratique bastante,
Bons Estudos,
Expedito Marcondes
‘//========’calcular notas finais
Sub sbx_calcular_notas()
Dim vCol, vLin As Integer
If ActiveSheet.Name = “Matematica” Then
For vLin = 4 To Cells(Rows.Count, “a”).End(xlUp).Row
For vCol = 2 To 5
Cells(vLin, vCol).Select
tSoma = tSoma + Cells(vLin, vCol).Value
Next vCol
Cells(vLin, vCol + 1) = (tSoma / (vCol – 2))
If Cells(vLin, “h”) < 5 And Cells(vLin, “g”) > 75 Then
Cells(vLin, “j”).Value = “Promovido”
Else
Cells(vLin, “j”).Value = “Retido”
End If
tSoma = 0
Next vLin
‘//=====CALCULANDO NOTAS FINAIS (3 PLANILHAS)
‘como as linhas e coluna são todas iguais posso fazer usar um ElseIF + Operador Or,
‘usando o operador Or(ou) para comparar nomes da planilha ativa e calcular notas
ElseIf ActiveSheet.Name = “Ingles” Or _
ActiveSheet.Name = “Estudos Sociais” Or _
ActiveSheet.Name = “Geometria” Then
For vLin = 4 To Cells(Rows.Count, “a”).End(xlUp).Row
For vCol = 2 To 5
Cells(vLin, vCol).Select
tSoma = tSoma + Cells(vLin, vCol).Value
Next vCol
Cells(vLin, vCol + 1) = (tSoma / (vCol – 2))
tSoma = 0
Next vLin
End If
[f1].Select
End Sub
‘//=========================’
Sub sbx_limpar_teste()
If ActiveSheet.Name = “Matematica” Then
x = Cells(Rows.Count, “a”).End(xlUp).Row
Range(Cells(4, “g”), Cells(x, “g”)).ClearContents
Range(Cells(4, “j”), Cells(x, “j”)).ClearContents
ElseIf ActiveSheet.Name = “Estudos Sociais” Or _
ActiveSheet.Name = “Ingles” Or _
ActiveSheet.Name = “Geometria” Then
x = Cells(Rows.Count, “a”).End(xlUp).Row
Range(Cells(4, “g”), Cells(x, “g”)).ClearContents
End If
End Sub
![]()
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.

PROMOÇÃO ESPECIAL – EXCEL VBA Adquirir o Material Didático Escola SaberExcel VBA Estudos
Baixe o exemplo de planilha contendo os macros acima:
Planilha Excel VBA calculos notas finais operadores or and
