La Pregunta 3

01/09/2005 - 17:55 por Hermano2 | Informe spam
Hola Hector Miguel
Pongo el codigo y tira un error solamente poniendo la fecha, realmente no
probe otra cosa pero eso se que no anda :(
Desde ya muchisimas gracias por todo lo que me estas ayudando.. sos un GROSO

Dim MoverSeleccion As Boolean, Direccion
Private Sub Workbook_Open()
MoverSeleccion = Application.MoveAfterReturn
If MoverSeleccion Then Direccion = Application.MoveAfterReturnDirection
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlToRight
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.MoveAfterReturn = MoverSeleccion
If MoverSeleccion Then Application.MoveAfterReturnDirection = Direccion
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("a2:e2000")) Is Nothing Then Exit Sub
Application.EnableEvents = False
If Target.Count > 1 Then ActiveCell.Select
If ActiveCell.Column > 1 Then GoTo Salida
If IsEmpty(ActiveCell) Then GoTo Salida
If ActiveCell.NumberFormat = "@" Then GoTo Salida
ActiveCell.NumberFormat = "@"
ActiveCell = Right("000000" & CLng(Format(ActiveCell, "ddmmyy")), 6)
Salida:
Application.EnableEvents = True
If ActiveCell.Column = 1 Then _
If IsEmpty(ActiveCell.Offset(-1, 4)) Then ActiveCell.Offset(-1, 4) = 0
If ActiveCell.Column > 1 Then _
If Not IsEmpty(Cells(ActiveCell.Row, 1)) Then _
If Cells(ActiveCell.Row, 1).NumberFormat = "@" Then _
Worksheet_Change Cells(ActiveCell.Row, 1)
If ActiveCell.Column = 5 Then
If IsEmpty(ActiveCell.Offset(, -1)) Then ActiveCell.Offset(, -1) = 0
SendKeys "{f2}"
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("a2:e2000")) Is Nothing Then Exit Sub
If Target.Column > 1 Then GoTo Salta
If IsEmpty(Target) Then GoTo Salta
Application.EnableEvents = False
Target.NumberFormat = "d/mm/yyyy"
Target = DateSerial(Right(Target, 2), Mid(Target, 3, 2), Left(Target, 2))
Application.EnableEvents = True
Salta:
With Target
If .Row = 2000 And .Column = 5 Then Range("b2").Select: Exit Sub
Cells(.Row + IIf(.Column = 5, _
IIf(.Row = 2000, -1998, 1), 0), _
.Column + IIf(.Column = 5, -4, 1)).Select
End With
End Sub
 

Leer las respuestas

#1 Héctor Miguel
01/09/2005 - 22:38 | Informe spam
hola, Hermano2 !

Pongo el codigo y tira un error solamente poniendo la fecha, realmente no probe otra cosa pero eso se que no anda :(



las instrucciones [de acuerdo con lo solicitado desde la primer consulta]...
estan 'evaluando' una entrada de fecha que contenga seis numerales [formato ddmmaa] ;)
suponiendo que el codigo lo probaste 'sobre' libro y/u hoja 'impia/nueva/en blanco'...
[probablemente] 'la primer' entrada de fecha no ha cumplido este 'requisito' -?-

por que no haces mas pruebas par ver que 'cosillas' le pudieran -realmente- 'doler' al codigo propuesto?
[una vez que puedas 'simular/experimentar/...' bajo las condiciones 'reales' de operacion] :))

comentas?
saludos,
hector.

Preguntas similares