ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   time stamp on MULTIPLE cells by PASTING (https://www.excelbanter.com/excel-discussion-misc-queries/125666-time-stamp-multiple-cells-pasting.html)

FARAZ QURESHI

time stamp on MULTIPLE cells by PASTING
 
Though I have been provided with excellent macros for inserting a time stamp
on the corresponding cells of column C for each entry in column B but I'm not
able to achieve the goal when pasting an array on column B by getting a full
similar height of array on column C.

Please Help!

Thanx & regards

Gord Dibben

time stamp on MULTIPLE cells by PASTING
 
Faraz

I finally came up with this code that enters a time stamp in C for each range of
cells pasted into B.

If C has a time stamp, it will not change.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim myrange
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 2 Then
myrange = Target.Value
For Each myrange In Target
If myrange.Offset(0, 1).Value = "" Then
myrange.Offset(0, 1).Value = Format(Now, "h:mm:ss")
End If
Next
End If
enditall:
Application.EnableEvents = True
End Sub

Alternative........C changes when new cells are copied to B

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim myrange
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
myrange = Target.Value
Target.Offset(0, 1).Value = Now
End If
enditall:
Application.EnableEvents = True
End Sub

Gord

Just don't try to copy and paste an entire column

On Wed, 10 Jan 2007 23:03:00 -0800, FARAZ QURESHI
wrote:

Though I have been provided with excellent macros for inserting a time stamp
on the corresponding cells of column C for each entry in column B but I'm not
able to achieve the goal when pasting an array on column B by getting a full
similar height of array on column C.

Please Help!

Thanx & regards



FARAZ QURESHI

time stamp on MULTIPLE cells by PASTING
 
GORD

U R GREAT!!!!!!!!!!

THANX AGAIN!!!!!!!!!!

"Gord Dibben" wrote:

Faraz

I finally came up with this code that enters a time stamp in C for each range of
cells pasted into B.

If C has a time stamp, it will not change.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim myrange
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 2 Then
myrange = Target.Value
For Each myrange In Target
If myrange.Offset(0, 1).Value = "" Then
myrange.Offset(0, 1).Value = Format(Now, "h:mm:ss")
End If
Next
End If
enditall:
Application.EnableEvents = True
End Sub

Alternative........C changes when new cells are copied to B

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim myrange
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
myrange = Target.Value
Target.Offset(0, 1).Value = Now
End If
enditall:
Application.EnableEvents = True
End Sub

Gord

Just don't try to copy and paste an entire column

On Wed, 10 Jan 2007 23:03:00 -0800, FARAZ QURESHI
wrote:

Though I have been provided with excellent macros for inserting a time stamp
on the corresponding cells of column C for each entry in column B but I'm not
able to achieve the goal when pasting an array on column B by getting a full
similar height of array on column C.

Please Help!

Thanx & regards





All times are GMT +1. The time now is 08:15 PM.

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