- 09 Mar 2021 às 10:53
#62727
Bom dia amigos, gostaria de saber se é possível colocar esse sistema de Busca para funcionar, segue abaixo:
Imagem:

https://ibb.co/zQ9vCr5
conforme a imagem, Gostaria que quando digita-se o numero da nota, ele marcasse dentro da tabela a linha referente.
Código:
Private Sub cmd_mov_Click()
If tb_cod.Value = Empty Then
Exit Sub
End If
tb_entradas.Enabled = True
tb_saidas.Enabled = True
cmd_ok.Enabled = True
cmd_mov.Enabled = False
End Sub
Private Sub cmd_ok_Click()
Dim v_saidas As Long
v_saidas = ActiveCell(1, 9).Value
If tb_saidas.Value > v_saidas Then
MsgBox “Estoque insuficiente para essa sáida.”
tb_saidas.Value = ActiveCell(1, 9).Value
tb_saidas.SetFocus
Exit Sub
End If
ActiveCell(1, 7).Value = ActiveCell(1, 7).Value + tb_entradas.Value
ActiveCell(1, 8).Value = ActiveCell(1, 8).Value + tb_saidas.Value
ActiveCell(1, 9).Value = ActiveCell(1, 9).Value + tb_entradas - tb_saidas
tb_entradas.Enabled = False
tb_saidas.Enabled = False
cmd_ok.Enabled = False
cmd_mov.Enabled = True
tb_estoque.Value = ActiveCell(1, 9).Value
tb_entradas.Value = 0
tb_saidas.Value = 0
UserForm_Initialize
End Sub
'AREA DO BOTÃO DE BUSCA'
Private Sub CommandButton1_Click()
End Sub
Private Sub Label10_Click()
End Sub
Private Sub Label19_Click()
End Sub
Private Sub ltb_estoque_Click()
On Error GoTo ERRO01:
Columns(“CJ:CJ”).Select
Selection.Find(What:=ltb_estoque.Value, After:=ActiveCell, LookAt:=xlWhole).Activate
navega
ERRO01:
End Sub
Private Sub navega()
tb_cod.Value = ActiveCell(1, 1).Value
tb_desc.Value = ActiveCell(1, 2).Value
tb_cor.Value = ActiveCell(1, 3).Value
tb_estampa.Value = ActiveCell(1, 4).Value
tb_tamanho.Value = ActiveCell(1, 5).Value
tb_valor.Value = Format(ActiveCell(1, 6).Value, “###,##0.00”)
'tb_entradas.Value = ActiveCell(1, 7).Value
'tb_saidas.Value = ActiveCell(1, 8).Value
tb_estoque.Value = ActiveCell(1, 9).Value
End Sub
Private Sub tb_cod_Change()
End Sub
Private Sub tb_cor_Change()
End Sub
'AREA DA TABELA'
Private Sub UserForm_Initialize()
Range(“CJ2”).Select
navega
Dim i As Long, k As Long
Dim Tabela(65500, 8) 'ESSA É A MATRIZ COM 50 LINHAS E 11 COLUNAS
With Sheets(“Cadastro”)
'Loop para as células da coluna C
For i = 2 To .Cells(Rows.Count, 88).End(xlUp).Row
For k = 1 To 9
If k = 6 Then
Tabela(i - 2, k - 1) = Format(.Cells(i, k + 87).Value, “###,##0.00”)
Else
Tabela(i - 2, k - 1) = .Cells(i, k + 87).Value
End If
Next k
Next i
End With
ltb_estoque.List = Tabela
End Sub
Desde já, agradeço!

Imagem:
https://ibb.co/zQ9vCr5
conforme a imagem, Gostaria que quando digita-se o numero da nota, ele marcasse dentro da tabela a linha referente.
Código:
Private Sub cmd_mov_Click()
If tb_cod.Value = Empty Then
Exit Sub
End If
tb_entradas.Enabled = True
tb_saidas.Enabled = True
cmd_ok.Enabled = True
cmd_mov.Enabled = False
End Sub
Private Sub cmd_ok_Click()
Dim v_saidas As Long
v_saidas = ActiveCell(1, 9).Value
If tb_saidas.Value > v_saidas Then
MsgBox “Estoque insuficiente para essa sáida.”
tb_saidas.Value = ActiveCell(1, 9).Value
tb_saidas.SetFocus
Exit Sub
End If
ActiveCell(1, 7).Value = ActiveCell(1, 7).Value + tb_entradas.Value
ActiveCell(1, 8).Value = ActiveCell(1, 8).Value + tb_saidas.Value
ActiveCell(1, 9).Value = ActiveCell(1, 9).Value + tb_entradas - tb_saidas
tb_entradas.Enabled = False
tb_saidas.Enabled = False
cmd_ok.Enabled = False
cmd_mov.Enabled = True
tb_estoque.Value = ActiveCell(1, 9).Value
tb_entradas.Value = 0
tb_saidas.Value = 0
UserForm_Initialize
End Sub
'AREA DO BOTÃO DE BUSCA'
Private Sub CommandButton1_Click()
End Sub
Private Sub Label10_Click()
End Sub
Private Sub Label19_Click()
End Sub
Private Sub ltb_estoque_Click()
On Error GoTo ERRO01:
Columns(“CJ:CJ”).Select
Selection.Find(What:=ltb_estoque.Value, After:=ActiveCell, LookAt:=xlWhole).Activate
navega
ERRO01:
End Sub
Private Sub navega()
tb_cod.Value = ActiveCell(1, 1).Value
tb_desc.Value = ActiveCell(1, 2).Value
tb_cor.Value = ActiveCell(1, 3).Value
tb_estampa.Value = ActiveCell(1, 4).Value
tb_tamanho.Value = ActiveCell(1, 5).Value
tb_valor.Value = Format(ActiveCell(1, 6).Value, “###,##0.00”)
'tb_entradas.Value = ActiveCell(1, 7).Value
'tb_saidas.Value = ActiveCell(1, 8).Value
tb_estoque.Value = ActiveCell(1, 9).Value
End Sub
Private Sub tb_cod_Change()
End Sub
Private Sub tb_cor_Change()
End Sub
'AREA DA TABELA'
Private Sub UserForm_Initialize()
Range(“CJ2”).Select
navega
Dim i As Long, k As Long
Dim Tabela(65500, 8) 'ESSA É A MATRIZ COM 50 LINHAS E 11 COLUNAS
With Sheets(“Cadastro”)
'Loop para as células da coluna C
For i = 2 To .Cells(Rows.Count, 88).End(xlUp).Row
For k = 1 To 9
If k = 6 Then
Tabela(i - 2, k - 1) = Format(.Cells(i, k + 87).Value, “###,##0.00”)
Else
Tabela(i - 2, k - 1) = .Cells(i, k + 87).Value
End If
Next k
Next i
End With
ltb_estoque.List = Tabela
End Sub
Desde já, agradeço!
