Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
  • Avatar do usuário
Por frodrigo
#31075
Quando insiro a data do formulario para a celula ela passa de dd/mm/aaaa para mm/dd/aaaa, não estou conseguindo corrigir, segue o codigo que estou utilizando abaixo, as textbox que se referem a data são a TextBox 4 e TextBox2

Private Sub CommandButton1_Click()
lsInserirTextBox frmCadastro, "Cadastro", 1

lsLimparTextBox frmCadastro

TextBox1.SetFocus
End Sub

Private Sub lsInserir(ByRef lTextBox As Variant, ByVal lSheet As String, ByVal lColunaCodigo As Long, ByVal lUltimaLinha As Long)
If (TypeOf lTextBox Is MSForms.TextBox) Or (TypeOf lTextBox Is MSForms.ComboBox) Then
Sheets(lSheet).Range(lTextBox.Tag & lUltimaLinha).Value = lTextBox.Text

Else
If TypeOf lTextBox Is MSForms.OptionButton Then
If lTextBox.Value = True Then
Sheets(lSheet).Range(lTextBox.Tag & lUltimaLinha).Value = lTextBox.Caption
End If
End If
End If
End Sub

Public Function lsInserirTextBox(formulario As UserForm, ByVal lSheet As String, ByVal lColunaCodigo As Long)
Dim controle As Control
Dim lUltimaLinhaAtiva As Long

lUltimaLinhaAtiva = Worksheets(lSheet).Cells(Worksheets(lSheet).Rows.Count, lColunaCodigo).End(xlUp).Row + 1

For Each controle In formulario.Controls
lsInserir controle, lSheet, lColunaCodigo, lUltimaLinhaAtiva
Next
End Function

Public Function lsLimparTextBox(formulario As UserForm)
Dim controle As Control

For Each controle In formulario.Controls
If TypeOf controle Is MSForms.TextBox Then
controle.Text = ""
End If
Next
End Function

Private Sub CommandButton2_Click()
lsLimparTextBox frmCadastro

TextBox1.SetFocus
End Sub

Private Sub Frame1_Click()

End Sub

Private Sub Label1_Click()

End Sub

Private Sub Label3_Click()

End Sub

Private Sub Label4_Click()

End Sub

Private Sub OptionButton2_Click()

End Sub

Private Sub TextBox2_Change()

End Sub

Private Sub TextBox3_Change()

End Sub

Private Sub TextBox4_Change()

End Sub
Avatar do usuário
Por gfranco
Avatar
#31088
Boa tarde.
Experimente utilizar o "VBA.Cdate( a informação que quer na planilha)
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord