gugadg
02-02-2015 17:48:18
Olá tenho essa planilha e estou com esse código. O que quer dele é simples. É colocar os valores inseridos na caixa de texto em uma planilha conforme for mudando o grupo escolhido num combobox terá uma coluna diferente. Depois de inserido preciso que retorne num label um frase analisando se o somatório da coluna do grupo é igual ou maior ou menor que outro somatório do grupo, se for maior preciso que além da frase vá o valor excedente. Não estou conseguindo fazer essa parte segue a planilha também.
Código: Selecionar todos
http://speedy.sh/VcK7W/EXEMPLO.xlsm
Código: Selecionar todos
Private Sub CommandButton1_Click()
If TextBox1.Value = "" Then
Exit Sub
End If
If ComboBox1.Value = "" Then
Exit Sub
End If
If ComboBox1.Value = "INTERLIGAÇÃO FRIGORÍFICA" Then
Dim varA As Variant
With Sheets("teste 1").Cells(Rows.Count, 1).End(xlUp)
.Offset(1, 0).Value = TextBox1.Text
End With
varA = Sheets("teste 1").Range("j7").Value
If varA < 0 Then
Label3.Caption = "Consumo dentro do orçado"
ElseIf varA = 0 Then
Label3.Caption = "Consumo dentro do orçado"
Else
varA > 0 then Label3.Caption = 6
End If
ComboBox1.ListIndex = -1
TextBox1.Text = ""
End If
End If
End Sub