Thanks, that works great! On Jan 21, 3:19 pm, Paul Schreiner <schreiner_p...@att.net> wrote: > Ok, first of all, the sub should be a change event, so that it is triggered > when you make a change to the worksheet. > > Second, You really don't need the cdate function. > > Third, I would recommend that you use the Application.EnableEvents function > so that you don't trigger the change event when you are adding the date > (or removing the date). > > Try putting this sub in your VBA sheet module: > > Private Sub Worksheet_Change(ByVal Target As Range) > If (Intersect(Target, Range("A1:A100")) Is Nothing) Then Exit Sub > If Target.Count > 1 Then Exit Sub 'Preventing of editing multiple > If Target = "" Then > Application.EnableEvents = False > Target.Offset(0, 1).ClearContents > Application.EnableEvents = True > Else > Application.EnableEvents = False > Target.Offset(0, 1) = Format(Now, "dd.mm.yyyy") > Application.EnableEvents = True > End If > End Sub > > Paul > > ----- Original Message ---- > > From: Tobi Hammet <speich...@gmail.com> > > To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com> > > Sent: Wednesday, January 21, 2009 2:30:34 AM > > Subject: $$Excel-Macros$$ Date of Entry in cell -> automatically into next > > collumn! > > > Hey everyone, > > > I wanted to have an entry of date everytime i make a new entry in > > A1:A100 > > the dates should dissapear when i delete the content. > > > I thought this should work: > > > Sub auto_date() > > 'Quelle: tob > > If Intersect(Target, Range("A1:A100")) Is Nothing Then Exit Sub > > If Target.Count > 1 Then Exit Sub 'Preventing of editing multiple > > cells > > If Target = "" Then > > Target.Offset(0, 1).ClearContents > > Else: > > Target.Offset(0, 1) = CDate(Format(Now, "dd.mm.yyyy")) > > End If > > End Sub > > > ************ > > but it doesn't :( > > I am using excel 2007 > > > any clues?
--~--~---------~--~----~------------~-------~--~----~ Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To post to this group, send email to excel-macros@googlegroups.com For more options, visit this group at http://groups.google.com/group/excel-macros?hl=en Visit & Join Our Orkut Community at http://www.orkut.com/Community.aspx?cmm=22913620 To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com To see the Daily Excel Tips, Go to: http://exceldailytip.blogspot.com If you find any spam message in the group, please send an email to Ayush @ jainayus...@gmail.com -~----------~----~----~----~------~----~------~--~---