Ir para conteúdo
Fórum Script Brasil

Ana Flavia Oliveira

Membros
  • Total de itens

    2
  • Registro em

  • Última visita

Sobre Ana Flavia Oliveira

Ana Flavia Oliveira's Achievements

0

Reputação

  1. Trata-se de um formulário simples, porém muito extenso. O erro está aparecendo na linha" Sheets("Lançamentos").Cells(Linha, 316).Value = hora_inicio20.Value". Quando tento cadastrar os dados, ele apresenta esse erro, ainda que o form abra normalmente. Segue o código (a linha que está em verde é onde está apresentando o erro): Private Sub CommandButton14_Click() Call proc1 Call proc2 Call proc3 Call proc4 Call proc5 End Sub Private Sub proc1() Linha = Sheets("Lançamentos").Range("A1048576").End(xlUp).Row + 1 Sheets("Lançamentos").Cells(Linha, 1).Value = caixadata.Value Sheets("Lançamentos").Cells(Linha, 2).Value = caixacodigo.Value Sheets("Lançamentos").Cells(Linha, 3).Value = hora_inicio.Value Sheets("Lançamentos").Cells(Linha, 4).Value = hora_fim.Value Sheets("Lançamentos").Cells(Linha, 5).Value = executante.Value If botaoveri1 = True Then Sheets("Lançamentos").Cells(Linha, 6).Value = "X" End If If botaoajuste1 = True Then Sheets("Lançamentos").Cells(Linha, 7).Value = "X" End If If botaotroca1 = True Then Sheets("Lançamentos").Cells(Linha, 8).Value = "X" End If If botaolubri1 = True Then Sheets("Lançamentos").Cells(Linha, 9).Value = "X" End If Sheets("Lançamentos").Cells(Linha, 10).Value = hora_inicio2.Value Sheets("Lançamentos").Cells(Linha, 11).Value = hora_fim2.Value Sheets("Lançamentos").Cells(Linha, 12).Value = executante2.Value If botaoveri2 = True Then ... End sub (O código se repete por mais várias linhas, mudando apenas as colunas e o índice de hora_inicio, hora_fim e executante) ... Private Sub proc2() ... If botaoveri65 = True Then Sheets("Lançamentos").Cells(Linha, 312).Value = "X" End If If botaoajuste65 = True Then Sheets("Lançamentos").Cells(Linha, 313).Value = "X" End If If botaotroca65 = True Then Sheets("Lançamentos").Cells(Linha, 314).Value = "X" End If If botaolubri65 = True Then Sheets("Lançamentos").Cells(Linha, 315).Value = "X" End If Sheets("Lançamentos").Cells(Linha, 316).Value = hora_inicio20.Value Sheets("Lançamentos").Cells(Linha, 317).Value = hora_fim20.Value Sheets("Lançamentos").Cells(Linha, 318).Value = executante20.Value ... Sheets("Lançamentos").Cells(Linha, 894).Value = observacao.Value MsgBox ("Cadastrado com sucesso!"), vbInformation, "CADASTRO" End sub ...
  2. Trata-se de um formulário simples, porém muito extenso. O erro está aparecendo na linha" Sheets("Lançamentos").Cells(Linha, 316).Value = hora_inicio20.Value". Quando tento cadastrar os dados, ele apresenta esse erro, ainda que o form abra normalmente. Segue o código (a linha que está em verde é onde está apresentando o erro): Private Sub CommandButton14_Click() Call proc1 Call proc2 Call proc3 Call proc4 Call proc5 End Sub Private Sub proc1() Linha = Sheets("Lançamentos").Range("A1048576").End(xlUp).Row + 1 Sheets("Lançamentos").Cells(Linha, 1).Value = caixadata.Value Sheets("Lançamentos").Cells(Linha, 2).Value = caixacodigo.Value Sheets("Lançamentos").Cells(Linha, 3).Value = hora_inicio.Value Sheets("Lançamentos").Cells(Linha, 4).Value = hora_fim.Value Sheets("Lançamentos").Cells(Linha, 5).Value = executante.Value If botaoveri1 = True Then Sheets("Lançamentos").Cells(Linha, 6).Value = "X" End If If botaoajuste1 = True Then Sheets("Lançamentos").Cells(Linha, 7).Value = "X" End If If botaotroca1 = True Then Sheets("Lançamentos").Cells(Linha, 8).Value = "X" End If If botaolubri1 = True Then Sheets("Lançamentos").Cells(Linha, 9).Value = "X" End If Sheets("Lançamentos").Cells(Linha, 10).Value = hora_inicio2.Value Sheets("Lançamentos").Cells(Linha, 11).Value = hora_fim2.Value Sheets("Lançamentos").Cells(Linha, 12).Value = executante2.Value If botaoveri2 = True Then ... End sub (O código se repete por mais várias linhas, mudando apenas as colunas e o índice de hora_inicio, hora_fim e executante) ... Private Sub proc2() ... If botaoveri65 = True Then Sheets("Lançamentos").Cells(Linha, 312).Value = "X" End If If botaoajuste65 = True Then Sheets("Lançamentos").Cells(Linha, 313).Value = "X" End If If botaotroca65 = True Then Sheets("Lançamentos").Cells(Linha, 314).Value = "X" End If If botaolubri65 = True Then Sheets("Lançamentos").Cells(Linha, 315).Value = "X" End If Sheets("Lançamentos").Cells(Linha, 316).Value = hora_inicio20.Value Sheets("Lançamentos").Cells(Linha, 317).Value = hora_fim20.Value Sheets("Lançamentos").Cells(Linha, 318).Value = executante20.Value ... Sheets("Lançamentos").Cells(Linha, 894).Value = observacao.Value MsgBox ("Cadastrado com sucesso!"), vbInformation, "CADASTRO" End sub ...
×
×
  • Criar Novo...