Notifications
Clear all

[Resolvido] Problemas com macro (erro em tempo de execução '1004')

9 Posts
3 Usuários
0 Reactions
1,572 Visualizações
(@acjunior)
Posts: 0
New Member
Topic starter
 

Bom dia, minha planilha com formulário estava funcionando perfeitamente. Do nada apareceu esse erro toda vez que preencho um novo cadastro. A unica alteração que fiz foi adicionar mais 1 usuário na aba oculta.

 
Postado : 21/08/2020 11:12 am
(@acjunior)
Posts: 0
New Member
Topic starter
 

gostaria de dicas para diminuir o tamanho da minha planilha tbm, pois esta com mais de 3mb e nao consigo manda-la aqui

 
Postado : 21/08/2020 11:17 am
(@edsonbr)
Posts: 0
New Member
 

Bem vindo ao Planilhando, @acjunior

  • Poste um modelo simplificado aqui, mas que reproduza o problema.
  • Se tiver tabelas com muitas linhas de dados, deixe apenas uma quantidade razoável para testes (não esqueça de eliminar informações confidenciais).
  • Formatação geralmente é o que mais faz crescer o tamanho de um arquivo. Limpe formatações que não sejam essenciais.
  • Imagens e objetos (formas, boxes, conteúdos colados de internet, etc.) também ocupam bastante espaço.
  • Ou use um serviço na nuvem, como o sendspace, etc...
 
Postado : 21/08/2020 1:05 pm
(@acjunior)
Posts: 0
New Member
Topic starter
 

@edsonbr boa tarde,

a formatação esta bem simples. 

nao entendo o que esta acontecendo. so inclui um nome e travou a planilha.

vou mandar 2 prints, 1 de como ta o inicio da tabela e outro o erro

 

 
Postado : 21/08/2020 4:23 pm
(@acjunior)
Posts: 0
New Member
Topic starter
 

imagem 2

 
Postado : 21/08/2020 4:26 pm
(@anderson)
Posts: 0
New Member
 

Sub Abre_Formulario()



Marcacao.Show

End Sub

Private Sub botaoexcluir_Click()

Unload Marcacao_Consultas

End Sub



Private Sub box_doc_matricula_Change()

End Sub

Private Sub box_matricula_Change()

End Sub

Private Sub box_nome_Change()

End Sub

Private Sub box_paciente_Change()

End Sub

Private Sub ComboBox1_Change()

End Sub

Private Sub CommandButton1_Click()


If box_doc_matricula.Text = "" Then
MsgBox "CAMPO Nº DO DOC./MATRICULA OBRIGATÓRIO", vbExclamation, "AVISO"
box_doc_matricula.SetFocus
Exit Sub
End If
If box_orgaoemissor.Text = "" Then
MsgBox "CAMPO ORGÃO EMISSOR OBRIGATÓRIO", vbExclamation, "AVISO"
box_orgaoemissor.SetFocus
Exit Sub
End If
If lista_tipo.Text = "" Then
MsgBox "CAMPO TIPO OBRIGATÓRIO", vbExclamation, "AVISO"
lista_tipo.SetFocus
Exit Sub
End If
If box_nome.Text = "" Then
MsgBox "CAMPO NOME OBRIGATÓRIO", vbExclamation, "AVISO"
box_nome.SetFocus
Exit Sub
End If
If lista_destino.Text = "" Then
MsgBox "CAMPO SETOR DE DESTINO OBRIGATÓRIO", vbExclamation, "AVISO"
lista_destino.SetFocus
Exit Sub
End If
If lista_Máscara.Text = "" Then
MsgBox "CAMPO TIPO OBRIGATÓRIO", vbExclamation, "AVISO"
lista_Máscara.SetFocus
Exit Sub
End If

Dim linha As Long
linha = 2

While Planilha1.Range("B" & linha).Value <> ""
linha = linha + 1
Wend
Planilha1.Unprotect "123"
Planilha1.Cells(linha, 2) = recep
Planilha1.Cells(linha, 5) = box_doc_matricula.Value
Planilha1.Cells(linha, 6) = box_orgaoemissor.Value
Planilha1.Cells(linha, 7) = lista_tipo.Value
Planilha1.Cells(linha, 8) = box_nome.Value
Planilha1.Cells(linha, 9) = lista_destino.Value
Planilha1.Cells(linha, 10) = box_paciente.Value
Planilha1.Cells(linha, 11) = box_matricula.Value
Planilha1.Cells(linha, 12) = lista_Máscara.Value
Planilha1.Protect "123"

Unload Marcacao





End Sub

Private Sub CommandButton1_Enter()

End Sub

Private Sub Label1_Click()

End Sub

Private Sub Label12_Click()

End Sub

Private Sub Label5_Click()

End Sub

Private Sub Label9_Click()

End Sub

Private Sub lista_destino_Change()

End Sub

Private Sub Lista_Máscara_Change()

End Sub

Private Sub lista_tipo_Change()

End Sub

Sub abrirmarcacao_consultas()


TextBox_Usuario.Show


End Sub

Sub TextBox1_Change()
TextBox_Usuario.Show



End Sub

Private Sub Recepcionista_Change()

End Sub

Private Sub TextBoxUsuario_Change()

End Sub

Private Sub UserForm_Initialize()

TextBoxUsuario = Planilha3.Range("E1").Text

ult_linha = Sheets("Tipo").Range("A2").End(xlDown).Row

lista_tipo.RowSource = "Tipo!A2:A" & ult_linha

ult_linha = Sheets("Destino").Range("A2").End(xlDown).Row

lista_destino.RowSource = "Destino!A2:A" & ult_linha

ult_linha = Sheets("Máscara").Range("A2").End(xlDown).Row

lista_Máscara.RowSource = "Máscara!A2:A" & ult_linha



End Sub
Este post foi modificado 4 anos atrás por Anderson
 
Postado : 23/08/2020 10:11 am
(@acjunior)
Posts: 0
New Member
Topic starter
 

estou lhe enviando agora anderson, Muito obrigado pela ajuda.

 
Postado : 24/08/2020 10:05 am
(@anderson)
Posts: 0
New Member
 

Basta desproteger e proteger a planilha.

 
Postado : 24/08/2020 10:43 am
(@acjunior)
Posts: 0
New Member
Topic starter
 

Muito obrigado pela sua ajuda Anderson, foi de uma atenção sem igual.

 

 
Postado : 24/08/2020 11:07 am