Erro critico de tipos de variáveis
Vejam o código abaixo:
Option Explicit
' CRIA A VARIÁVEL Vm QUE ARMAZENA O VALOR MÍNIMO DE COMPRAS
Dim Vm As Variant
' CRIA A VARIÁVEL Bonus QUE ARMAZENA OS BONUS REAIS A RECEBER
Dim Bonus As Currency
Sub Calculo()
Bonus = Range(Cells(6, 4), Cells(18, 4)).Value
If Cells(6, 4) >= 0 And Cells(6, 4) <= 4890.2 Then
Vm = 250
Cells(6, 5) = Vm
End If
If Cells(7, 4) >= 0 And Cells(7, 4) <= 4890.2 Then
Vm = 250
Cells(7, 5) = Vm
End If
If Cells(8, 4) >= 0 And Cells(8, 4) <= 4890.2 Then
Vm = 250
Cells(8, 5) = Vm
End If
If Cells(9, 4) >= 0 And Cells(9, 4) <= 4890.2 Then
Vm = 250
Cells(9, 5) = Vm
End If
If Cells(10, 4) >= 0 And Cells(10, 4) <= 4890.2 Then
Vm = 250
Cells(10, 5) = Vm
End If
If Cells(11, 4) >= 0 And Cells(11, 4) <= 4890.2 Then
Vm = Bonus + (Bonus * 0.12)
Cells(11, 5) = Vm
End If
If Cells(12, 4) >= 4890.21 And Cells(12, 4) <= 8982 Then
Vm = Bonus + (Bonus * 0.12)
Cells(12, 4) = Vm
End If
If Cells(13, 4) >= 8982.01 And Cells(13, 4) <= 19960 Then
Vm = Bonus + (Bonus * 0.1)
Cells(13, 5) = Vm
End If
If Cells(14, 4) >= 19960.01 And Cells(14, 4) <= 34930 Then
Vm = Bonus + (Bonus * 0.08)
Cells(14, 5) = Vm
End If
If Cells(15, 4) >= 34930.01 And Cells(15, 4) <= 69860 Then
Vm = Bonus + (Bonus * 0.07)
Cells(15, 5) = Vm
End If
If Cells(16, 4) >= 69860.01 And Cells(16, 4) <= 134730 Then
Vm = Bonus + (Bonus * 0.06)
Cells(16, 5) = Vm
End If
If Cells(17, 4) >= 134730.01 Then
Vm = Bonus + (Bonus * 0.05)
Cells(17, 5) = Vm
End If
End Sub
Tenho uma tabela onde nas células D6 A D18 possui valores monetários que chegam na casa dos milhões de reais. Apenas quero comparar se essa célula estiver nas condições ditas acima, e caso ocorra a condição, escreva nas células E6 a E18, o conteúdo da variável Vm.
Porém está dando uns erros que não estou entendendo.
Se alguém puder me ajudar, ficarei muito grato.
Discussão (3)
Carregando comentários...