Usuário com melhor resposta
Ajuda Excel Formulario UserForms

Pergunta
-
Prezado Evangelista,
boa tarde!
Estou precisando de ajuda para fazer um Formulário através de UserForms.
Está dando erro, quando Clik em "Ok" para salvar,dá a mensagem de:
Erro em Tempo de execução 424:
O objeto é obrigatório
Se você puder me ajudar, desde já fico muito agradecido.
Abraços
Luiz
Respostas
-
O seu erro estava colocando o DDFunc como nome da Sheet que na verdade era Plan3
Agora com o código abaixo está funcionando,
Abraços,
Private Sub CommandButton2_Click()
Dim UltLin As Long
With Plan3
UltLin = .Cells(.Rows.Count, "b").End(xlUp).Row + 1
End With
Plan3.Cells(UltLin, 1).Value = TextBox1
Plan3.Cells(UltLin, 2).Value = TextBox2
Plan3.Cells(UltLin, 3).Value = TextBox3
Plan3.Cells(UltLin, 4).Value = TextBox4
Plan3.Cells(UltLin, 5).Value = TextBox5
Plan3.Cells(UltLin, 6).Value = TextBox6
Plan3.Cells(UltLin, 7).Value = TextBox7
Plan3.Cells(UltLin, 8).Value = TextBox8
Plan3.Cells(UltLin, 9).Value = TextBox9
Plan3.Cells(UltLin, 10).Value = TextBox10
Plan3.Cells(UltLin, 11).Value = TextBox11
Plan3.Cells(UltLin, 12).Value = TextBox12
Plan3.Cells(UltLin, 13).Value = TextBox13
Plan3.Cells(UltLin, 14).Value = TextBox14
Unload MeEnd Sub
Baldini Fabio- Sugerido como Resposta Baldini quinta-feira, 15 de julho de 2010 16:14
- Marcado como Resposta Hezequias VasconcelosModerator terça-feira, 11 de dezembro de 2012 13:06
Todas as Respostas
-
-
Ola, Baldini...
O Comando que estou usando para o Botão "Ok" é:
Private Sub CommandButton2_Click()
Dim UltLin As Long
With DDFunc
UltLin = .Cells(.Rows.Count, "b").End(xlUp).Row + 1
End With
DDFunc.Cells(UltLin, 1).Value = TextBox1
DDFunc.Cells(UltLin, 2).Value = TextBox2
DDFunc.Cells(UltLin, 3).Value = TextBox3
DDFunc.Cells(UltLin, 4).Value = TextBox4
DDFunc.Cells(UltLin, 5).Value = TextBox5
DDFunc.Cells(UltLin, 6).Value = TextBox6
DDFunc.Cells(UltLin, 7).Value = TextBox7
DDFunc.Cells(UltLin, 8).Value = TextBox8
DDFunc.Cells(UltLin, 9).Value = TextBox9
DDFunc.Cells(UltLin, 10).Value = TextBox10
DDFunc.Cells(UltLin, 11).Value = TextBox11
DDFunc.Cells(UltLin, 12).Value = TextBox12
DDFunc.Cells(UltLin, 13).Value = TextBox13
DDFunc.Cells(UltLin, 14).Value = TextBox14
Unload Me
End Sube está dando erro:
Erro em Tempo de execução 424:
O objeto é obrigatórioAbraços
Luiz
-
-
Olá, Baldini, tudo bem,
Fiz a alteração, mas continua dando o mesmo erro. A planilha com o nome de "DDFunc", ela existe, e neste mesmo arquivo existe outras planilhas mas com nome diferente. Teria como eu mandar o arquivo para você verificar!
Abraços,
Luiz
-
-
O seu erro estava colocando o DDFunc como nome da Sheet que na verdade era Plan3
Agora com o código abaixo está funcionando,
Abraços,
Private Sub CommandButton2_Click()
Dim UltLin As Long
With Plan3
UltLin = .Cells(.Rows.Count, "b").End(xlUp).Row + 1
End With
Plan3.Cells(UltLin, 1).Value = TextBox1
Plan3.Cells(UltLin, 2).Value = TextBox2
Plan3.Cells(UltLin, 3).Value = TextBox3
Plan3.Cells(UltLin, 4).Value = TextBox4
Plan3.Cells(UltLin, 5).Value = TextBox5
Plan3.Cells(UltLin, 6).Value = TextBox6
Plan3.Cells(UltLin, 7).Value = TextBox7
Plan3.Cells(UltLin, 8).Value = TextBox8
Plan3.Cells(UltLin, 9).Value = TextBox9
Plan3.Cells(UltLin, 10).Value = TextBox10
Plan3.Cells(UltLin, 11).Value = TextBox11
Plan3.Cells(UltLin, 12).Value = TextBox12
Plan3.Cells(UltLin, 13).Value = TextBox13
Plan3.Cells(UltLin, 14).Value = TextBox14
Unload MeEnd Sub
Baldini Fabio- Sugerido como Resposta Baldini quinta-feira, 15 de julho de 2010 16:14
- Marcado como Resposta Hezequias VasconcelosModerator terça-feira, 11 de dezembro de 2012 13:06
-
Ok, Baldini
Está Funcionando mesmo, fico muito agradecido por ter me ajudado. Agora só para eu entender a Plan3 que eu renomei para DDFunc, na hora de escrever o código não posso escrever DDFunc e sim Plan3, que é a original !!!
Mais uma Pergunta, agora que está funcionando, surgiu mais uma dúvida quando estou inserindo os dados precisava que inserisse a partir da Coluna B, só que está inserindo partir da Coluna A, tem como resolver!!!
Muito Obrigado
Abraços
Luiz
-
Olá Cunha tem sim
É só mudar o 1 para 2 em diante conforme o exemplo abaixo,
Abração
Private Sub CommandButton2_Click()
Dim UltLin As Long
With Plan3
UltLin = .Cells(.Rows.Count, "b").End(xlUp).Row + 1
End With
Plan3.Cells(UltLin, 2).Value = TextBox1
Plan3.Cells(UltLin, 3).Value = TextBox2
Plan3.Cells(UltLin, 4).Value = TextBox3
Plan3.Cells(UltLin, 5).Value = TextBox4
Plan3.Cells(UltLin, 6).Value = TextBox5
Plan3.Cells(UltLin, 7).Value = TextBox6
Plan3.Cells(UltLin, 8).Value = TextBox7
Plan3.Cells(UltLin, 9).Value = TextBox8
Plan3.Cells(UltLin, 10).Value = TextBox9
Plan3.Cells(UltLin, 11).Value = TextBox10
Plan3.Cells(UltLin, 12).Value = TextBox11
Plan3.Cells(UltLin, 13).Value = TextBox12
Plan3.Cells(UltLin, 14).Value = TextBox13
Plan3.Cells(UltLin, 15).Value = TextBox14
Unload MeEnd Sub
Baldini Fabio- Sugerido como Resposta Baldini quinta-feira, 15 de julho de 2010 21:00
-
-