Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default worksheet_change D.McRitchie

I found Dave McRitchie's code that would work perfect for my post of 9/10 -
Capture date and data...
But I can't seem to modify it to allow me set as target multiple cells in
diferent locations throughout the sheet and then stamp date and record each
change on another sheet.
---------------------------
I also found the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
With Sheets("sheet2")
x = .Cells(Rows.Count, "a").End(xlUp).Row + 1
If Target.Address = "$B$4" Then .Cells(x, "a") = Target
End With
End Sub
Which would work perfect if I could combine Dave's code with this one and
make it multiple target cells.

Could you please give me a hand?
As always, very grateful for any help you can give me.

I need to date certain cells as they change and copy them to another sheet.
I only find
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default worksheet_change D.McRitchie

One way:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myRng As Range
Dim myCell As Range
Dim NextRow As Long

Set myRng = Me.Range("a:a,b1:c9")

If Intersect(Target, myRng, Me.UsedRange) Is Nothing Then Exit Sub

On Error GoTo errHandler:

Application.EnableEvents = False
For Each myCell In Intersect(Target, myRng, Me.UsedRange).Cells
With Worksheets("sheet2")
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
.Cells(NextRow, "A").Value = "'" & myCell.Value
.Cells(NextRow, "B").Value = myCell.Address
With .Cells(NextRow, "C")
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With
End With
Next myCell

errHandler:
Application.EnableEvents = True

End Sub

Myriam wrote:

I found Dave McRitchie's code that would work perfect for my post of 9/10 -
Capture date and data...
But I can't seem to modify it to allow me set as target multiple cells in
diferent locations throughout the sheet and then stamp date and record each
change on another sheet.
---------------------------
I also found the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
With Sheets("sheet2")
x = .Cells(Rows.Count, "a").End(xlUp).Row + 1
If Target.Address = "$B$4" Then .Cells(x, "a") = Target
End With
End Sub
Which would work perfect if I could combine Dave's code with this one and
make it multiple target cells.

Could you please give me a hand?
As always, very grateful for any help you can give me.

I need to date certain cells as they change and copy them to another sheet.
I only find


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default worksheet_change D.McRitchie

It's brilliant! Thanks! It works perfect!

"Dave Peterson" wrote:

One way:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myRng As Range
Dim myCell As Range
Dim NextRow As Long

Set myRng = Me.Range("a:a,b1:c9")

If Intersect(Target, myRng, Me.UsedRange) Is Nothing Then Exit Sub

On Error GoTo errHandler:

Application.EnableEvents = False
For Each myCell In Intersect(Target, myRng, Me.UsedRange).Cells
With Worksheets("sheet2")
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
.Cells(NextRow, "A").Value = "'" & myCell.Value
.Cells(NextRow, "B").Value = myCell.Address
With .Cells(NextRow, "C")
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With
End With
Next myCell

errHandler:
Application.EnableEvents = True

End Sub

Myriam wrote:

I found Dave McRitchie's code that would work perfect for my post of 9/10 -
Capture date and data...
But I can't seem to modify it to allow me set as target multiple cells in
diferent locations throughout the sheet and then stamp date and record each
change on another sheet.
---------------------------
I also found the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
With Sheets("sheet2")
x = .Cells(Rows.Count, "a").End(xlUp).Row + 1
If Target.Address = "$B$4" Then .Cells(x, "a") = Target
End With
End Sub
Which would work perfect if I could combine Dave's code with this one and
make it multiple target cells.

Could you please give me a hand?
As always, very grateful for any help you can give me.

I need to date certain cells as they change and copy them to another sheet.
I only find


--

Dave Peterson


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
David McRitchie (subject header) Walter Copeland Setting up and Configuration of Excel 1 September 24th 05 12:56 AM
David McRitchie/Thanks David Excel Programming 2 May 30th 04 02:32 PM
Att: David McRitchie Mike R[_2_] Excel Programming 0 February 4th 04 12:46 PM
worksheet_change vs. calculate, and worksheet_change not running Tom Ogilvy Excel Programming 1 July 14th 03 02:51 AM
worksheet_change vs. calculate, and worksheet_change not running Ross[_5_] Excel Programming 0 July 13th 03 04:27 PM


All times are GMT +1. The time now is 02:54 AM.

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

About Us

"It's about Microsoft Excel"