Ir para conteúdo
Fórum Script Brasil
  • 0

VBE


Ronaldo73

Pergunta

Oi,

Estou com problema, alguém pode me ajudar.

Olha eu tem um formulario Visual Basic com Excel

Formulário eu tenho:

Nº Nota Fiscal............................TxtNotaFiscal

Despesas..................................CmbDespesas

Data de Vencimento...................TxtVencimento

Valor........................................TxtValor

Só que, ao gravar o documento no excel o valor não soma e a data fica em ordem inversa.

Por ex:

Eu digito no formulário 14/02/09 e ao gravar na planilha do excel fica assim 02/14/09.

Como corrigir este erro no código abaixo.

' A LINHA ABAIXO DETERMINA A PLAN3 (Despesas (-)) COMO SELECIONADA

ActiveWorkbook.Sheets("Despesas (-)").Activate

Range("c5").Select

'O CÓDIGO ABAIXO PROCURA A PRÓXIMA CÉLULA VAZIA

Do

If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(1, 0).Select

End If

Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = TxtNotaFiscal.Value

ActiveCell.Offset(0, 1).Value = CmbDespesas.Value

ActiveCell.Offset(0, 3).Value = TxtVencimento.Value

ActiveCell.Offset(0, 4).Value = TxtValor.Value

If MsgBox("Confirma a operação?", vbYesNo + vbQuestion, "Confirmação") = vbYes Then

End If

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

  • 0

VERIFICA A FORMATAÇÃO DA CÉLULA ONDE VAI A INFORMAÇÃO TAMBEM

' A LINHA ABAIXO DETERMINA A PLAN3 (Despesas (-)) COMO SELECIONADA

ActiveWorkbook.Sheets("Despesas (-)").Activate

Range("c5").Select

'O CÓDIGO ABAIXO PROCURA A PRÓXIMA CÉLULA VAZIA

Do

If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(1, 0).Select

End If

Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = TxtNotaFiscal.Value

ActiveCell.Offset(0, 1).Value = CmbDespesas.Value

ActiveCell.Offset(0, 3).Value = Format(TxtVencimento.Value, "dd/mm/yyyy")

ActiveCell.Offset(0, 4).Value = TxtValor.Value

Link para o comentário
Compartilhar em outros sites

  • 0

Obrigado Reyam.

Abraço

VERIFICA A FORMATAÇÃO DA CÉLULA ONDE VAI A INFORMAÇÃO TAMBEM

' A LINHA ABAIXO DETERMINA A PLAN3 (Despesas (-)) COMO SELECIONADA

ActiveWorkbook.Sheets("Despesas (-)").Activate

Range("c5").Select

'O CÓDIGO ABAIXO PROCURA A PRÓXIMA CÉLULA VAZIA

Do

If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(1, 0).Select

End If

Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = TxtNotaFiscal.Value

ActiveCell.Offset(0, 1).Value = CmbDespesas.Value

ActiveCell.Offset(0, 3).Value = Format(TxtVencimento.Value, "dd/mm/yyyy")

ActiveCell.Offset(0, 4).Value = TxtValor.Value

Obrigado

José

Abraço

Altere a linha:

ActiveCell.Offset(0, 4).Value = TxtValor.Value

por

ActiveCell.Offset(0, 4).Value = CDbl(TxtValor)

Quando a data:

CDate(TxtVencimento)

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...