Results 1 to 4 of 4

insert current date in cell if specific text is entered

Threaded View

DKMPE insert current date in cell... 01-30-2014, 03:43 PM
Olly Re: Need help with code...... 01-30-2014, 04:08 PM
alansidman Re: Need help with code...... 01-30-2014, 04:09 PM
alansidman Re: Need help with code...... 01-30-2014, 04:09 PM
  1. #1
    Registered User
    Join Date
    01-29-2014
    Location
    Haverslev, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    1

    insert current date in cell if specific text is entered

    Hi Guys

    im having a problem writing this code...

    i want it to do this..:

    when a user types "dd" in a cell, the macro should insert the current date. and if the user types a date, this date will stay in the cell

    any ideas?

    here is the code a have tried to write

    Sub Worksheet_Change(ByVal Target As Range)
        Dim KeyCells As Range
           Set KeyCells = Range("B19")
        
        Dim newval As Variant
        
        newval = Range("K2").Value
        
        If Application.Intersect(KeyCells, Range(Target.Address)).Value = "dd" Then
    
        Range("B19").Value = newval
                   
           End If
        
    End Sub
    Last edited by DKMPE; 01-30-2014 at 04:45 PM. Reason: code tags added

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 12-17-2013, 11:51 AM
  2. Replies: 1
    Last Post: 11-13-2013, 10:28 AM
  3. Replies: 2
    Last Post: 03-09-2013, 04:30 AM
  4. Code for email alerts from excel isn't working, wrong code possibly?
    By jessthorogood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2012, 01:45 AM
  5. Replies: 2
    Last Post: 03-17-2011, 08:55 PM

Tags for this Thread

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