Veja se assim atende
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column = 4 Then
With Target
If Cells(.Row, .Column) <> "" Then
Cells(.Row, 1) = VBA.Format(Date, "Ddd")
Cells(.Row, 2) = VBA.Format(Date, "mm/dd/yy")
Cells(.Row, 7) = VBA.Format(Time, "hh:mm:ss")
Cells(.Row, 11) = "Presente"
ElseIf Cells(.Row, .Column) = "" Then
Cells(.Row, 1) = ""
Cells(.Row, 2) = ""
Cells(.Row, 3) = ""
Cells(.Row, 5) = ""
Cells(.Row, 6) = ""
Cells(.Row, 7) = ""
Cells(.Row, 8) = ""
Cells(.Row, 9) = ""
Cells(.Row, 10) = ""
End If
End With
ElseIf Target.Column = 8 Then
With Target
If Cells(.Row, .Column) <> "" Then
Cells(.Row, 11) = ""
End If
End With
End If
End Sub
ou assim:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Select Case Target.Column
Case 4
With Target
If Cells(.Row, .Column) <> "" Then
Cells(.Row, 1) = VBA.Format(Date, "Ddd")
Cells(.Row, 2) = VBA.Format(Date, "mm/dd/yy")
Cells(.Row, 7) = VBA.Format(Time, "hh:mm:ss")
Cells(.Row, 11) = "Presente"
ElseIf Cells(.Row, .Column) = "" Then
Cells(.Row, 1) = ""
Cells(.Row, 2) = ""
Cells(.Row, 3) = ""
Cells(.Row, 5) = ""
Cells(.Row, 6) = ""
Cells(.Row, 7) = ""
Cells(.Row, 8) = ""
Cells(.Row, 9) = ""
Cells(.Row, 10) = ""
End If
End With
Case 8
With Target
If Cells(.Row, .Column) <> "" Then
Cells(.Row, 11) = ""
End If
End With
End Select
End Sub
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 01/05/2013 4:29 am