Jump to content
Fórum Script Brasil
  • 0

SUBTRAIR DADOS entre textbox VBA excel



Galera tenho uma userform com tres textbox onde coloco a hora inicial, na outra a hora final, e gostaria que na terceira textbox não fosse editável e mostrasse a diferença em horas entre a textbox2 e a textbox1 assim que os dados fossem inseridos nas duas primeiras textbox. Já fiz de tudo e até hoje não consegui.

eu fiz dessa maneira mas não deu certo:

Private Sub HINICIO_Change()

HINICIO.MaxLength = 5

If Len(HINICIO) = 2 Or Len(HINICIO) = 2 Then

HINICIO.Text = HINICIO.Text & ":"

SendKeys "{End}", True

End If

End Sub

Private Sub HFINAL_Change()

HFINAL.MaxLength = 5

If Len(HFINAL) = 2 Or Len(HFINAL) = 2 Then

HFINAL.Text = HFINAL.Text & ":"

SendKeys "{End}", True

End If

End Sub

Private Sub TEMPO_Change()

Dim x As Integer

Dim y As Integer

x = HINICIO.Text

y = HFINAL.Text

TEMPO.Text = y - x

End Sub

Agradeço a todos :rolleyes:

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...