Sou meio iniciante no VBA ainda e estou com um problema nesse programa que estou fazendo.Gostaria muito que alguém pudesse me ajudar !!
O erro citado no título do post aparece na linha "capitaldegiro = somacapitais /qntdanos"\
Private Sub ComboBox1_Change()
End Sub
Private Sub CommandButton1_Click()
Dim qntdanos As Integer
Dim capitaldegiro As Currency
Dim somacapitais As Currency
Dim ano As Integer
With Sheets("Dados")
ano = ComboBox1.Value
mes = ComboBox2.Text
qntdanos = Application.WorksheetFunction.CountIf(.Range("A2:A17"), "<ano")
End With
With Sheets("Fluxo")
ano = ComboBox1.Value
mes = ComboBox2.Text
somacapitais = Application.WorksheetFunction.SumIf(.Range("C:C"), "=mes", .Range("I:I"))
capitaldegiro = somacapitais / qntdanos
Label4 = "O capital de giro necessário é:" & capitaldegiro
End With
End Sub
Private Sub CommandButton2_Click()
Unload UserForm3
End Sub
Private Sub Label2_Click()
End Sub
Private Sub Label3_Click()
End Sub
Private Sub Label4_Click()
End Sub
Private Sub OptionButton2_Click()
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
'Inserir Anos e Meses nas combobox
linha = 2
Do Until Sheets("Dados").Cells(linha, 1) = ""
ComboBox1.AddItem Sheets("Dados").Cells(linha, 1)
linha = linha + 1
Loop
linha = 2
Do Until Sheets("Dados").Cells(linha, 2) = ""
ComboBox2.AddItem Sheets("Dados").Cells(linha, 2)
linha = linha + 1
Loop
End Sub
Pergunta
AleSalvatore
Olá,
Sou meio iniciante no VBA ainda e estou com um problema nesse programa que estou fazendo.Gostaria muito que alguém pudesse me ajudar !!
O erro citado no título do post aparece na linha "capitaldegiro = somacapitais /qntdanos"\
Private Sub ComboBox1_Change() End Sub Private Sub CommandButton1_Click() Dim qntdanos As Integer Dim capitaldegiro As Currency Dim somacapitais As Currency Dim ano As Integer With Sheets("Dados") ano = ComboBox1.Value mes = ComboBox2.Text qntdanos = Application.WorksheetFunction.CountIf(.Range("A2:A17"), "<ano") End With With Sheets("Fluxo") ano = ComboBox1.Value mes = ComboBox2.Text somacapitais = Application.WorksheetFunction.SumIf(.Range("C:C"), "=mes", .Range("I:I")) capitaldegiro = somacapitais / qntdanos Label4 = "O capital de giro necessário é:" & capitaldegiro End With End Sub Private Sub CommandButton2_Click() Unload UserForm3 End Sub Private Sub Label2_Click() End Sub Private Sub Label3_Click() End Sub Private Sub Label4_Click() End Sub Private Sub OptionButton2_Click() End Sub Private Sub UserForm_Click() End Sub Private Sub UserForm_Initialize() 'Inserir Anos e Meses nas combobox linha = 2 Do Until Sheets("Dados").Cells(linha, 1) = "" ComboBox1.AddItem Sheets("Dados").Cells(linha, 1) linha = linha + 1 Loop linha = 2 Do Until Sheets("Dados").Cells(linha, 2) = "" ComboBox2.AddItem Sheets("Dados").Cells(linha, 2) linha = linha + 1 Loop End SubObrigado desde já,Alexandre
Link para o comentário
Compartilhar em outros sites
1 resposta a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.