ERRO EM TEMPO DE EXECUÇÃO '94"' USO DE 'NULL" INVÁLIDO Empty ERRO EM TEMPO DE EXECUÇÃO '94"' USO DE 'NULL" INVÁLIDO

PauinhoTuca

03-03-2021 01:57:48

Código: Selecionar todos

Sub Editar()

bloqueado = True
Dim tabela As ListObject
Dim n As Integer, l As Integer
Set tabela = Planilha1.ListObjects(1)

n = UserForm2.ListBox1.Value
l = tabela.Range.Columns().Find(n, , , xlWhole).Row

tabela.Range(l, 2).Value = UserForm2.txtorcamento.Value
tabela.Range(l, 3).Value = UserForm2.txtdata.Value
tabela.Range(l, 4).Value = UserForm2.txtHora.Value
tabela.Range(l, 5).Value = UserForm2.cbbVendedor.Value
tabela.Range(l, 6).Value = UserForm2.txtcliente.Value
tabela.Range(l, 7).Value = UserForm2.txtcidade.Value
tabela.Range(l, 8).Value = UserForm2.txtuf.Value

tabela.Range(l, 9).Value = IIf(UserForm2.obpadrao, "Padrão", "Fora de Padrão")      < AQUI APARECE O ERRO

tabela.Range(l, 10).Value = UserForm2.cbbProduto.Value
tabela.Range(l, 11).Value = UserForm2.txtcapacidade.Value
tabela.Range(l, 12).Value = UserForm2.txtpreco.Value
tabela.Range(l, 13).Value = UserForm2.txtContato.Value
tabela.Range(l, 14).Value = UserForm2.txttelefone.Value
tabela.Range(l, 15).Value = UserForm2.txtcelular.Value
tabela.Range(l, 16).Value = UserForm2.txtemail.Value
tabela.Range(l, 17).Value = UserForm2.cbbStatus.Value
tabela.Range(l, 18).Value = UserForm2.txtDataDeRetorno.Value
tabela.Range(l, 19).Value = UserForm2.txtObs.Value

Call atualizar_listbox
MsgBox "O Registro foi atualizado"

bloqueado = False

End Sub

Boa noite, não sei como resolver este erro alguem pode me auxiliar, arquivo em anexo

Reinaldo

03-03-2021 12:36:47

Uma possibilidade:

Código: Selecionar todos

...
tabela.Range(n, 5).Value = UserForm2.cbbVendedor.Value
tabela.Range(n, 6).Value = UserForm2.txtcliente.Value
tabela.Range(n, 7).Value = UserForm2.txtcidade.Value
tabela.Range(n, 8).Value = UserForm2.txtuf.Value
'tabela.Range(n, 9).Value = IIf(UserForm2.obpadrao, "Padrão", "Fora de Padrão")
If UserForm2.obpadrao = True Then
    tabela.Range(n, 9).Value = "Padrão"
Else
    tabela.Range(n, 9).Value = "Fora de Padrão"
End If
tabela.Range(n, 10).Value = UserForm2.cbbProduto.Value
tabela.Range(n, 11).Value = UserForm2.txtcapacidade.Value
tabela.Range(n, 12).Value = UserForm2.txtpreco.Value
...

paulotuca

12-03-2021 20:18:19

Boa tarde Muito obrigado deu certo