+ Reply to Thread
Results 1 to 3 of 3

How to remove date in one cell when another cell's contents are cleared.

  1. #1
    Registered User
    Join Date
    02-24-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    18

    How to remove date in one cell when another cell's contents are cleared.

    Hello,

    I have a drop down list in the cells of column E. When I select a item from the drop down list, the date is inserted into the cell of the same row in column B. I would like to adjust the code to also remove the date in the cell of column B when I delete the contents of the cell in the same row in column E.

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Cells.Count > 1 Then Exit Sub

    If Not Intersect(Target, Range("E43:E100000")) Is Nothing Then

    With Target(1, -2)

    .Value = Date


    End With

    End If

    End Sub

    Thank you,

    John

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to remove date in one cell when another cell's contents are cleared.

    ok

    Try this sample:

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Cells.Count > 1 Then Exit Sub

    If Not Intersect(Target, Range("E1:E100000")) Is Nothing Then

    If Target <> "" Then
    Target(1, -2).Value = Date
    Else: Target(1, -2).Value = ""
    End If

    End If

    End Sub
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    02-24-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: How to remove date in one cell when another cell's contents are cleared.

    mehmetcik,

    Thank you very much. It worked just as I wanted.

    Thank you again,

    John

+ Reply to Thread

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