Target definieren
27.08.2004 11:41:38
Corinne
Ich habe folgenden code (die Grundlage ist aus dem Forum - danke) und möchte nun das Target auf eine Zelle AFxx definiern, da die Geschichte mit dem Offset mühsam ist. Kann jemand helfen?
Gruss
Co
Private Sub Worksheet_Change(ByVal Target As Range)
' marks the last update date in case of changes in the cell in range "Range"
'Defines the area to be checked for changes
mColumn = ActiveCell.Column
mRow = ActiveCell.Row
Set Target = Application.Intersect(Target, Range("A3:AE" & mRow))
'If not within the range, the sub is being left
If Target Is Nothing Then Exit Sub
' Activates error handling
On Error GoTo ErrorHandler
'Turns of events to avoid re-update
Application.EnableEvents = False
' sets the zone where the date should be entered
Target.Offset(0, 32 - mColumn) = Now
ErrorHandler:
Application.EnableEvents = True ' turns on events again
End Sub