By some unknown reason my If statement is not working properly i tried to invert the signals if seek of any improvement , but none so far. Leaving some of the code bellow.
For i = 1 To last
REFERENCIA = Application.ThisWorkbook.Worksheets("Registos").Cells(i, 8)
ENTRADAeSAIDA = Application.ThisWorkbook.Worksheets("Registos").Cells(i, 12)
CC = Application.ThisWorkbook.Worksheets("Registos").Cells(i, 6)
If REFERENCIA = registos.TextBox1 And registos.ComboBox1 = "SAÍDA" Then
Worksheets("registos").Select
ActiveSheet.ListObjects("Tabela1").Range.AutoFilter Field:=8, Criteria1:= _
registos.TextBox1.Text 'Filtrar referência
ActiveSheet.ListObjects("Tabela1").Range.AutoFilter Field:=6, Criteria1:= _
registos.Label11.Caption 'Filtrar CC
ActiveSheet.ListObjects("Tabela1").Range.AutoFilter Field:=12, Criteria1:= _
"ENTRADA" 'Filtrar Entrada
'Somar quantidades de peças de Entrada
xty100 = ThisWorkbook.Worksheets("calculos").Range("A1")
'' Worksheets("registos").Select
ActiveSheet.ListObjects("Tabela1").Range.AutoFilter Field:=12, Criteria1:= _
"SAÍDA" 'Filtrar Saída
xty101 = ThisWorkbook.Worksheets("calculos").Range("A1")
' 'Somar quantidade de peças de saída
sumfinal = xty100 - xty101
xytbx4 = Format(registos.TextBox4, "@")
If xytbx4 < sumfinal And xytbx4 > 0 Then
GoTo salto_2
Else
MsgBox "Não é possível movimentar mais que o stock atual!Stock " & sumfinal & ""
GoTo fim
End If
End If
Next i
Aucun commentaire:
Enregistrer un commentaire