Van los cambios
Dim h
'
Private Sub BTNGUARDAR_Click()
Dim fila As Long
Dim duplicados As Boolean
'Obtener la fila disponible
'fila = Application.WorksheetFunction.CountA(Range("A:A")) + 1
fila = h.Range("A" & Rows.Count).End(xlUp).Row + 1
duplicados = False
If Me.TXTUBICACION = "" Or Me.TXTEQUIPO = "" Or Me.TXTFECHA = "" Or Me.TXTINTERVENCION = "" Or Me.TXTTERMINO = "" Or Me.TXTDESCRIPCION = "" Then
MsgBox "No dejar ningun campo vacio ", vbOK
Else
'Insertar datos capturados
h.Cells(fila, 3).Value = Index.TXTUBICACION.Value
h.Cells(fila, 4).Value = Index.TXTEQUIPO.Value
h.Cells(fila, 5).Value = CDate(Index.TXTFECHA.Value)
h.Cells(fila, 6).Value = Index.TXTINTERVENCION.Value
h.Cells(fila, 7).Value = Index.TXTTERMINO.Value
h.Cells(fila, 8).Value = Index.TXTDESCRIPCION.Value
h.Cells(fila, "A").Value = Index.ComboBox1.Value
h.Cells(fila, "B").Value = Index.ComboBox2.Value
'RANGE("A:H").Select
' With Selection.Borders(xlEdgeBottom)
'.LineStyle = xlContinuous
'.Weight = xlThin
' .ColorIndex = xlAutomatic
'Limpiar TXT
Index.TXTUBICACION.Value = ""
Index.TXTEQUIPO.Value = ""
Index.TXTINTERVENCION.Value = ""
Index.TXTTERMINO.Value = ""
Index.TXTDESCRIPCION.Value = ""
Index.ComboBox1.Value = ""
Index.ComboBox2.Value = ""
MsgBox "Datos Correctamente Ingresados"
' End With
End If
End Sub
Private Sub BTNLISTAR_Click()
Load Listar
Listar.Show
End Sub
Private Sub btnsalir_Click()
'evalúa si hay otros libros abiertos
For Each wb In Workbooks
If wb.Name <> ActiveWorkbook.Name And UCase(Left(wb.Name, 8)) <> "Ingresar" Then i = 1
Next
'cierra el UF
Unload Me
'si es el único abierto cierra la aplicación
If i = 0 Then
'guarda el libro
ActiveWorkbook.Save
ActiveWorkbook.Application.Quit
Else
ActiveWorkbook.Close True '(guardado opcional)
End If
End Sub
Private Sub ComboBox2_Change()
End Sub
Private Sub Frame1_Click()
End Sub
Private Sub TXTFECHA_Change()
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
Set h = Sheets("Ingresar")
Me.TXTFECHA = Date
Me.TXTFECHA.Enabled = False
ComboBox1. AddItem "A"
ComboBox1. AddItem "B"
ComboBox1. AddItem "C"
ComboBox1. AddItem "D"
Rem combo2
ComboBox2. AddItem "800"
ComboBox2. AddItem "805"
ComboBox2. AddItem "806"
ComboBox2. AddItem "807"
End Sub
sal u dos