Consulting

Results 1 to 4 of 4

Thread: add date to the column during update in worksheet

  1. #1
    VBAX Regular
    Joined
    Dec 2015
    Posts
    15
    Location

    Exclamation add date to the column during update in worksheet

    Hi all,

    I've had a database worksheet and I was wondering how to automatically add date to first column when there is new column or new row added by user?


    Cheers

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Cells(RowNumber, ColumnNumber) = Date
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Regular
    Joined
    Dec 2015
    Posts
    15
    Location

    Exclamation

    Hi SamT,

    In my case, when I add anything in column C, it will show "Date" in Column D, may I know how could I make the "Date" show in Column B instead?

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Cells.Count > 1 Then Exit Sub
    
            If Not Intersect(Target, Range("C2:C100")) Is Nothing Then
    
                With Target(1, -2)
    
                    .Value = "Date"
    
                    .EntireColumn.AutoFit
    
                End With
    
            End If

  4. #4
    VBAX Regular
    Joined
    Dec 2015
    Posts
    15
    Location
    Sorry, the code With Target line should be #With Target(1, 2)#

Tags for this Thread

Posting Permissions

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