In this code, I'm attempting to incorporate a loop.
It just updates the first value I paste into the range it is referencing; it does not update any of the other cells. Is there a simple method to loop this and update it when I paste a range of cells so that it moves on to the next cell in the row that doesn't equal a blank?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xCellColumn As Integer
Dim xTimeColumn As Integer
Dim xRow, xCol As Integer
Dim xDPRg, xRg As Range
xCellColumn = 2
xTimeColumn = 9
xRow = Target.Row
xCol = Target.Column
If Target.Text <> "" Then
If xCol = xCellColumn Then
Cells(xRow, xTimeColumn) = Now()
Else
On Error Resume Next
Set xDPRg = Target.Dependents
For Each xRg In xDPRg
If xRg.Column = xCellColumn Then
Cells(xRg.Row, xTimeColumn) = Now()
End If
Next
End If
End If
End Sub
If there is anything further I can do, kindly let me know.
In order to record the time, I was anticipating a timestamp function that would let me paste ranges into the spreadsheet. Except for the first cell in the pasted range, it is not updating.