Fecha de modificación

Hola.
Necesitaba una macro que me ingrese en una celda determinada la fecha en la que se modifique cualquier valor en la hoja. ¿Es posible?
Un saludo.

1 respuesta

Respuesta
1
Puedes utilizar este código en el evento de hoja Change.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim cell As Range
Dim OldText As String, NewText As String
If CheckBox1 Then
For Each cell In Target
With cell
On Error Resume Next
OldText = .Comment.Text
If Err <> 0 Then .AddComment
NewText = OldText & "Cambiado a " & cell.Text & _
" por " & Application.UserName & " el " & Now & vbLf
.Comment.Text NewText
.Comment.Visible = True
.Comment.Shape.Select
Selection.AutoSize = True
.Comment.Visible = False
End With
Next cell
End If
End Sub
Private Function HasComment(r) As Boolean
Dim x As String
HasComment = False
On Error Resume Next
x = r.Comment.Text
If Err = 0 Then HasComment = True
End Function
[email protected]

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas