Change Event (How post Date/Time to Changed Cells Rows but different Column)
Dave, I was not real clear.
That said I know how to proceed.
In actuality, it is only the Target.Address cells (Rows) that I need to isolate.
Not specifically Range("A1:A5") which was used as a example.
Thanks EagleOne
Dave Peterson wrote:
You could loop through the cells in the range that changed (limited to just the
range you're interested in, too).
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myIntersect As Range
Dim myCell As Range
Dim myRngToCheck As Range
Set myRngToCheck = Me.Range("A1:A5") 'the area I care about
Set myIntersect = Intersect(Target, myRngToCheck)
If myIntersect Is Nothing Then
Exit Sub 'outside my range
End If
Application.EnableEvents = False
For Each myCell In myIntersect.Cells
With Me.Cells(myCell.Row, "H")
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
.Value = Now
End With
Next myCell
Application.EnableEvents = True
End Sub
wrote:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
MsgBox "Range " & Target.Address & " was changed."
End Sub
Using the above Sub:
Facts: Range("A1:A5") values have been changed
Goal: Need VBA to change Range("H1:H5") with Now()
Challenge: What if more than one cell is changed?
In short, if Target.Address = Range("A1:A5, A8")
What VBA code would change Target.Address Rows 1,2,3,4,5,8 but same rows in Column "H"?
TIA EagleOne
|