- 08 Set 2017 às 14:07
#26236
Boa Tarde, Galera.
Sou novato no assunto e gostaria de pedir uma ajuda dos colegas.
Estou desenvolvendo um controle de estoque e quis automatizar uma parte do processo, onde o usuário seleciona a checkbox que contem na propriedade caption o numero da nota (parte concluida), então quero rodar uma macro que veja quais checkbox estão com propriedade value=true e percorra a coluna da planilha para encontrar e na mesma linha em outra coluna escreva um numero prévia mente informado. Segue abaixo o que consegui fazer mas não esta rodando.
Agradeço antecipadamente a oportunidade de compartilhar.
Sub Movimentar_Estoque()
Dim Fornecedor As String
Dim Estagio As String
Dim Volume As Double
Dim Preço As Double
Dim NF As Integer
Dim Chkbx As Control
Fornecedor = Worksheets("Estoque").Range("B5").Value
Estagio = Worksheets("Estoque").Range("B3").Value
Preço = Worksheets("Estoque").Range("B7").Value
Volume = Worksheets("Estoque").Range("B13").Value
NF = Worksheets("Estoque").Range("B15").Value
For Each Chkbx In NUMERO_NOTAS.Controls
Do
If Chkbx.Value = True Then
If Worksheets("Entradas").Range("A1").Offset(i, 0).Value = "" Or _
Worksheets("Entradas").Range("A1").Offset(i, 90).Value <> "" Or _
Worksheets("Entradas").Range("A1").Offset(i, 11).Value <> Fornecedor Or _
Worksheets("Entradas").Range("A1").Offset(i, 5).Value <> Chkbx.Caption Then
Exit Do
ElseIf Chkbx.Value = True And Worksheets("Entradas").Range("A1").Offset(i, 0).Value <> "" And _
Estagio = "Transito" And Worksheets("Entradas").Range("A1").Offset(i, 11).Value = Fornecedor And _
Worksheets("Entradas").Range("A1").Offset(i, 5).Value = Chkbx.Value Then
Worksheets("Entradas").Range("A1").Offset(i, 90).Value = NF
End If
End If
Loop
Next Chkbx
MsgBox "Concluido!"
End Sub
Sou novato no assunto e gostaria de pedir uma ajuda dos colegas.
Estou desenvolvendo um controle de estoque e quis automatizar uma parte do processo, onde o usuário seleciona a checkbox que contem na propriedade caption o numero da nota (parte concluida), então quero rodar uma macro que veja quais checkbox estão com propriedade value=true e percorra a coluna da planilha para encontrar e na mesma linha em outra coluna escreva um numero prévia mente informado. Segue abaixo o que consegui fazer mas não esta rodando.
Agradeço antecipadamente a oportunidade de compartilhar.
Sub Movimentar_Estoque()
Dim Fornecedor As String
Dim Estagio As String
Dim Volume As Double
Dim Preço As Double
Dim NF As Integer
Dim Chkbx As Control
Fornecedor = Worksheets("Estoque").Range("B5").Value
Estagio = Worksheets("Estoque").Range("B3").Value
Preço = Worksheets("Estoque").Range("B7").Value
Volume = Worksheets("Estoque").Range("B13").Value
NF = Worksheets("Estoque").Range("B15").Value
For Each Chkbx In NUMERO_NOTAS.Controls
Do
If Chkbx.Value = True Then
If Worksheets("Entradas").Range("A1").Offset(i, 0).Value = "" Or _
Worksheets("Entradas").Range("A1").Offset(i, 90).Value <> "" Or _
Worksheets("Entradas").Range("A1").Offset(i, 11).Value <> Fornecedor Or _
Worksheets("Entradas").Range("A1").Offset(i, 5).Value <> Chkbx.Caption Then
Exit Do
ElseIf Chkbx.Value = True And Worksheets("Entradas").Range("A1").Offset(i, 0).Value <> "" And _
Estagio = "Transito" And Worksheets("Entradas").Range("A1").Offset(i, 11).Value = Fornecedor And _
Worksheets("Entradas").Range("A1").Offset(i, 5).Value = Chkbx.Value Then
Worksheets("Entradas").Range("A1").Offset(i, 90).Value = NF
End If
End If
Loop
Next Chkbx
MsgBox "Concluido!"
End Sub