Option Explicit
Dim aux1 As Boolean
Dim fecha1 As String
Private Sub UserForm_Initialize()
Application.Worksheets("bitacora").Select
bitacora.Height = 330
Me.txtasuntobitacora.Visible = False
Me.optmaquina.Value = True
With bitacora
bitacora.Top = 20
bitacora.Left = 200
End With
With Me.listmaqbitacora
.RowSource = "maquinas"
End With
With Me.listbitacora
.RowSource = "bitacora"
End With
End Sub
Private Sub btnfechabitacora_Click()
Range("e1").Value = Now
fecha1 = Range("e1").Value
Me.txtfechabitacora.Value = fecha1
End Sub
Private Sub optmaquina_Change()
Me.listmaqbitacora.Visible = True
Me.txtasuntobitacora.Visible = False
aux1 = False
End Sub
Private Sub optotro_Change()
Me.listmaqbitacora.Visible = False
Me.txtasuntobitacora.Visible = True
aux1 = True
End Sub
Private Sub btnvolveritembitacora_Click()
bitacora.Height = 330
End Sub
Private Sub btnaggitembitacora_Click()
Application.Worksheets("bitacora").Select
If aux1 = True Then
If Me.txtfechabitacora <> "" And Me.txtasuntobitacora <> "" And Me.txtdescripbitacora <> "" Then
Range("a" & Rows.Count).End(xlUp).Offset(1, 0).Select
ActiveCell = fecha1 AQUI SALE ERROR EN EL METODO DEFAULT DE OBJETO RANGE
ActiveCell.Offset(0, 1).Value = Me.txtasuntobitacora.Value
ActiveCell.Offset(0, 2).Value = Me.txtdescripbitacora.Value
Me.txtfechabitacora = Empty
Me.txtasuntobitacora = Empty
Me.txtdescripbitacora = Empty
Else
MsgBox "Complete todo el formulario", vbInformation, "Formularion incompleto"
End If
Else
If Me.txtfechabitacora <> "" And Me.listmaqbitacora <> "" And Me.txtdescripbitacora <> "" Then
Range("a" & Rows.Count).End(xlUp).Offset(1, 0).Select
ActiveCell = fecha1 AQUI SALE ERROR EN EL METODO DEFAULT DE OBJETO RANGE
ActiveCell.Offset(0, 1) = Me.listmaqbitacora.Value
ActiveCell.Offset(0, 2) = Me.txtdescripbitacora.Value
Me.txtfechabitacora = Empty
Me.listmaqbitacora = Empty
Me.txtdescripbitacora = Empty
Else
MsgBox "Complete todo el formulario", vbInformation, "Formularion incompleto"
End If
End If
End Sub
Private Sub btnlimpitembitacora_Click()
Me.txtfechabitacora = Empty
Me.listmaqbitacora = Empty
Me.txtasuntobitacora = Empty
Me.txtdescripbitacora = Empty
End Sub
Private Sub btnaggitem_Click()
bitacora.Height = 525
End Sub