Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50151

Copying data from a form to a cell

$
0
0
Hi this is my first post :cool:

Right now i have a vba that copies the data in the fields of a form and saves them on another sheet in a specific order.

My issue is that there are some field that need to be saved as numbers but they apear to be text untill I double click on them and then they turn in to numbers.

Im using excel 2007, bellow the code im using:

Private Sub CMDBUTGUARDAR_Click()

'this checks for empty boxes, important ones only
If NOMBRECIA.Value = "" Or FASE.Value = "" Or TIPOPREST.Value = "" Or OFICIAL.Value = "" Or MONTOAPRO.Value = "" Or TASA.Value = "" Or PLAZO.Value = "" Then
MsgBox ("Los campos: NOMBRE, FASE, TIPO, OFICIAL, MONTO APROVADO, TASA Y PLAZO deben estar llenos"), , "ERROR"
Cancel = True
Exit Sub
End If

Dim linea_libre As Long
Application.ScreenUpdating = False
Sheets("DATA").Select
linea_libre = WorksheetFunction.CountA(Range("A:A")) + 1
'after the = i just set the name of the text field or combo box and that copies the value at the moment in othe sheet
Cells(linea_libre, 1).Value = Now
Cells(linea_libre, 2).Value = Application.UserName
Cells(linea_libre, 3).Value = FASE
Cells(linea_libre, 4).Value = NOMBRECIA
Cells(linea_libre, 5).Value = TIPOPREST
Cells(linea_libre, 6).Value = OFICIAL
Cells(linea_libre, 7).Value = MONTOAPRO
Cells(linea_libre, 8).Value = TASA
Cells(linea_libre, 9).Value = PLAZO
Cells(linea_libre, 10).Value = GARANTIAS
Cells(linea_libre, 11).Value = UTIESTI
Cells(linea_libre, 12).Value = FECHAUTI
Cells(linea_libre, 13).Value = TextBox1
'this just delets the current data in the boxes
FASE.Value = ""
NOMBRECIA.Value = ""
TIPOPREST.Value = ""
OFICIAL.Value = ""
MONTOAPRO.Value = ""
TASA.Value = ""
PLAZO.Value = ""
GARANTIAS.Value = ""
UTIESTI.Value = ""
FECHAUTI.Value = ""
TextBox1.Value = ""

Sheets("MENU").Select

End Sub

Thanks for any help you can provide

Viewing all articles
Browse latest Browse all 50151