Código para Botón guardar en hoja única de un formulario vba
Agradezco por la gran ayuda que me as brindado tengo un inconveniente de un código que me diste y es que al ejecutar el formulario estando en otra hoja los datos que quiero guardar no las guarda en la hoja especifica, que faltaría para que guarde en la hoja correcta ya que la base de datos la tengo en la Hoja 26 y el código que me diste fue el siguiente.
Private Sub CommandButton8_Click() 'Por Dante If ComboBox1 = "" Or TextBox1 = "" Then MsgBox "No son Datos suficientes para Guardar", vbInformation, "" TextBox1.SetFocus Else u = Range("A" & Rows.Count).End(xlUp).Row + 1 If u < 6 Then u = 6 ActiveSheet.Cells(u, 1) = Date ActiveSheet.Cells(u, 2) = Format(Now, "hh:mm AM/PM") ActiveSheet.Cells(u, 5) = ComboBox1 ActiveSheet.Cells(u, 3) = ComboBox2 ActiveSheet.Cells(u, 4) = ComboBox3 If TextBox1 = "" Then t1 = "" Else t1 = Val(TextBox1) If TextBox2 = "" Then t2 = "" Else t2 = Val(TextBox2) If TextBox3 = "" Then t3 = "" Else t3 = Val(TextBox3) ActiveSheet.Cells(u, 28) = t1 ActiveSheet.Cells(u, 29) = t2 ActiveSheet.Cells(u, 18) = t3 ActiveSheet.Cells(u, 38) = t4 ActiveSheet.Cells(u, 50) = t5 ActiveSheet.Cells(u, 51) = t6 ActiveSheet.Cells(u, 20) = t8 MsgBox ("Se Guardaron correctamente los datos"), vbInformation ComboBox1 = Empty ComboBox2 = Empty ComboBox3 = Empty TextBox1 = Empty TextBox1.BackColor = &H80000005 TextBox2 = Empty TextBox2.BackColor = &H80000005 TextBox3 = Empty TextBox4 = Empty TextBox5 = Empty TextBox6 = Empty TextBox8 = Empty TextBox9 = Empty ComboBox1.SetFocus End If End Sub
2 respuestas
Respuesta de Dante Amor
1
Respuesta
1