Consulting

Results 1 to 2 of 2

Thread: Show date and time

  1. #1
    VBAX Regular
    Joined
    Sep 2008
    Posts
    24
    Location

    Show date and time

    Hi people,

    Just a really simple question, I have three worksheets in Excel Sheet1, Sheet2and Sheet3, all of them have different columns however column A is the same (column A is called Date/Time.) I have created a button on Sheet 4 and was wondering would it be possible to run some coding where when the button is clicked on sheet 4 then the current date and time is shown in Column A on all of the sheets from 1 to 3 on a new row?
    The format I would prefer would be something like 10/11/2008 13:05

    Thanks

  2. #2
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Greetings Ryu,

    You could have the below run from the button.

    Hope this helps,

    Mark

    [vba]Sub DateStamp()
    Dim _
    wks As Worksheet, _
    dtmStamp As Date

    dtmStamp = Format(Now(), "mm/dd/yyyy hh:mm")

    For Each wks In ThisWorkbook.Worksheets

    If Not wks.Name = "Sheet4" _
    Then wks.Range("A65536").End(xlUp).Offset(1).Value = dtmStamp
    Next

    End Sub[/vba]

Posting Permissions

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