Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Cell Update on Paste

I have the following code, which works terrificially.

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "F18:F450"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, -5).Value = Format(Date, "dd-mmm-yyyy")
End If
End With

End If

Const WS_RANGE_1 As String = "F18:L450"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE_1)) Is Nothing Then
With Target
If .Value < "" Then
Range("B2").Value = Format(Date, "dd-mmm-yyyy")
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

I use it to update a cell with the current date when something in the
specific range changes. What I normally do on this particular sheet is to
paste values in, because others update the information on the spreadsheet.
What I would like to happen is that when I paste information in from the
clipboard that the date in B2 gets updated with the current date after the
paste.

What do I need to do to modify my code to allow that to happen?

thanks for letting me know.
Terry
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Cell Update on Paste

Have you looked at the Worksheet_Activate or Worksheet_Deactivate events to
see if they would do the trick?

"Harddrive747" wrote:

I have the following code, which works terrificially.

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "F18:F450"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, -5).Value = Format(Date, "dd-mmm-yyyy")
End If
End With

End If

Const WS_RANGE_1 As String = "F18:L450"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE_1)) Is Nothing Then
With Target
If .Value < "" Then
Range("B2").Value = Format(Date, "dd-mmm-yyyy")
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

I use it to update a cell with the current date when something in the
specific range changes. What I normally do on this particular sheet is to
paste values in, because others update the information on the spreadsheet.
What I would like to happen is that when I paste information in from the
clipboard that the date in B2 gets updated with the current date after the
paste.

What do I need to do to modify my code to allow that to happen?

thanks for letting me know.
Terry

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Cell Update on Paste

I put this code into both places and it did not work. I did see a post
somewhere and for the lift of me, I can't find it that someone use some type
of command that he said it updated a cell even when a paste happened.

Thanks.

"JLGWhiz" wrote:

Have you looked at the Worksheet_Activate or Worksheet_Deactivate events to
see if they would do the trick?

"Harddrive747" wrote:

I have the following code, which works terrificially.

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "F18:F450"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, -5).Value = Format(Date, "dd-mmm-yyyy")
End If
End With

End If

Const WS_RANGE_1 As String = "F18:L450"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE_1)) Is Nothing Then
With Target
If .Value < "" Then
Range("B2").Value = Format(Date, "dd-mmm-yyyy")
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

I use it to update a cell with the current date when something in the
specific range changes. What I normally do on this particular sheet is to
paste values in, because others update the information on the spreadsheet.
What I would like to happen is that when I paste information in from the
clipboard that the date in B2 gets updated with the current date after the
paste.

What do I need to do to modify my code to allow that to happen?

thanks for letting me know.
Terry

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How will hyperlink cell reference update after copy paste? bjry Excel Worksheet Functions 2 May 12th 09 05:10 PM
Data Validation lists update orginal cell with list update [email protected] Excel Worksheet Functions 3 July 11th 08 07:56 AM
Need to paste/update info to correct row. Lonpuz Excel Programming 0 January 20th 08 05:51 PM
Update value of variable from one sheet to paste into another shee tibbs Excel Programming 4 October 4th 06 06:30 PM
Paste Functions and Update info jackle Excel Worksheet Functions 2 May 24th 05 06:55 PM


All times are GMT +1. The time now is 10:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"