ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Timestamp Problems (https://www.excelbanter.com/excel-programming/421945-timestamp-problems.html)

ComputerMech

Timestamp Problems
 
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 2 Then Exit Sub
If Target.Row = 1 Then Exit Sub
If IsEmpty(Target(1)) Then Exit Sub
If IsEmpty(Target.Offset(0, -1)) Then
Target.Offset(0, -1) = Date
Target.Offset(0, -1).NumberFormat = "yyyy-mm-dd"
End If
End Sub

This works fine if I type something but I am pasting data in the cells and
it does not put in the date is there any changes that can be made

Mike H

Timestamp Problems
 
Hi,

I'm confused, this works fine if you paste data into a single cell, are you
saying you want it to work if you paste into multiple cells?

Mike

"ComputerMech" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 2 Then Exit Sub
If Target.Row = 1 Then Exit Sub
If IsEmpty(Target(1)) Then Exit Sub
If IsEmpty(Target.Offset(0, -1)) Then
Target.Offset(0, -1) = Date
Target.Offset(0, -1).NumberFormat = "yyyy-mm-dd"
End If
End Sub

This works fine if I type something but I am pasting data in the cells and
it does not put in the date is there any changes that can be made


ComputerMech

Timestamp Problems
 
Ok let me go into a little more detail. I have two work sheets in this
workbook I have a macro that transfers data from the first sheet to a single
row on the second sheet. Now what I needed was when that data is transfered
then the second sheet will put the date it was transfered. The data is in
cells b:l and I want the date in a

"Mike H" wrote:

Hi,

I'm confused, this works fine if you paste data into a single cell, are you
saying you want it to work if you paste into multiple cells?

Mike

"ComputerMech" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 2 Then Exit Sub
If Target.Row = 1 Then Exit Sub
If IsEmpty(Target(1)) Then Exit Sub
If IsEmpty(Target.Offset(0, -1)) Then
Target.Offset(0, -1) = Date
Target.Offset(0, -1).NumberFormat = "yyyy-mm-dd"
End If
End Sub

This works fine if I type something but I am pasting data in the cells and
it does not put in the date is there any changes that can be made



All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com