Dierentes textbox con diferentes formatos...

Tengo el siguiente código que al poner datos en textbox este me los inserta en una hoja aparte

Que este código:

Private Sub ComboBox2_Change()Dim var2 As StringIf ComboBox2 = "" ThenElseCommandButton1.Locked = FalseSheets("proveedores").ActivateIf ComboBox2 = Empty ThenMsgBox "Para modificar primero seleccione proveedor", vbInformation, "Almacen"ComboBox2.ListIndex = 0ComboBox2.SetFocusEnd Ifvar2 = ComboBox2.Column(0)Cells.Find(What:=ComboBox2.Value, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _        xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _        , SearchFormat:=False).ActivateIf var2 = ActiveCell.Value ThenTextBox1.Value = ActiveCell.ValueTextBox2 = ActiveCell.Offset(0, 1)TextBox3 = ActiveCell.Offset(0, 2)TextBox4 = ActiveCell.Offset(0, 3)TextBox5 = ActiveCell.Offset(0, 4)TextBox6 = ActiveCell.Offset(0, 5)TextBox7 = ActiveCell.Offset(0, 6)TextBox8 = ActiveCell.Offset(0, 8)TextBox16 = ActiveCell.Offset(0, 7)TextBox18 = ActiveCell.Offset(0, 9)TextBox19 = ActiveCell.Offset(0, 10)TextBox2.Locked = FalseTextBox3.Locked = FalseTextBox4.Locked = FalseTextBox5.Locked = FalseTextBox6.Locked = FalseTextBox7.Locked = FalseTextBox8.Locked = FalseTextBox16.Locked = FalseTextBox18.Locked = FalseTextBox19.Locked = FalseEnd IfEnd IfEnd SubPrivate Sub ComboBox3_Change()If ComboBox3 = "" ThenElseCommandButton1.Locked = FalseSheets("proveedores").ActivateIf ComboBox3 = Empty ThenMsgBox "Para modificar primero seleccione proveedor", vbInformation, "Almacen"ComboBox3.ListIndex = 0ComboBox3.SetFocusEnd Ifvar3 = ComboBox3.Column(0)Cells.Find(What:=ComboBox3.Value, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _        xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _        , SearchFormat:=False).ActivateIf var3 = ActiveCell ThenTextBox2 = ActiveCellTextBox1 = ActiveCell.Offset(0, -1)TextBox3 = ActiveCell.Offset(0, 1)TextBox4 = ActiveCell.Offset(0, 2)TextBox5 = ActiveCell.Offset(0, 3)TextBox6 = ActiveCell.Offset(0, 4)TextBox7 = ActiveCell.Offset(0, 5)TextBox8 = ActiveCell.Offset(0, 6)TextBox18 = ActiveCell.Offset(0, 7)TextBox19 = ActiveCell.Offset(0, 8)TextBox2.Locked = FalseTextBox3.Locked = FalseTextBox4.Locked = FalseTextBox5.Locked = FalseTextBox6.Locked = FalseTextBox7.Locked = FalseTextBox8.Locked = FalseTextBox18.Locked = FalseTextBox19.Locked = FalseEnd IfEnd IfEnd Sub

ahora bien antes de insertar necesito dar formato como fecha, moneda, texto y numeros..

En algunos textbox no en todos... Como lo relaciono

1 Respuesta

Respuesta
1

Los controles Textbox son de texto, por lo tanto la "conversión" la genes que hacer al volcar los datos a la hoja, no al llenar los textbox salvo que los quieras x un detalle visual.

Entonces, aquí van algunos ejemplos:

Range("A2")= Cdbl(Textbox1) 

Esta seria para pasar valores con decimales. Otras "funciones de conversión" pueden ser:

CDate (para fechas), Val (para nros)

El formato moneda ya lo tendrás asignado en la hoja de antemano.

Sdos!

Entre tantas consultas que dejas parece que te ha quedado esta sin comentar y/o valorar.

Sdos!

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas