Results 1 to 9 of 9

Using macro to input static date

Threaded View

  1. #1
    Registered User
    Join Date
    06-28-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Using macro to input static date

    Hi,

    I found a piece of code on the internet that input the date into one column upon changing a another; however, I wanted to alter the code so that it would only input the date upon something being entered into the target column and not just any change (at the moment it puts the date in even if I clear all the information). I was also wondering whether it was possible to have the date disappear if the information is deleted.

    Here is the current code. I'd appreciate all the help I can get:


    Private Sub Worksheet_Change(ByVal Target As Range)
    Set t = Target
    Set a = Range("D:D")
    If Intersect(t, a) Is Nothing Then Exit Sub
    Application.EnableEvents = False
    t.Offset(0, 9).Value = Date
    Application.EnableEvents = True
    End Sub
    Last edited by Dark Pelican; 06-29-2011 at 06:44 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1