-1
Private Sub Worksheet Change (ByVal Target As Range)
Dim MyDataRng Às Range
Set MyDataRng = Range ("A2:A10")
If Intersect (Target, MyDataRng) Is Tawning Then Exit sub
On Error Resume Next
If Target.Offset (0, 1)
• Then
Target.Offset (0, 1) = Now
End If
Target.Offset (0, 2) = Now

I was trying to get auto filled date and time to my worksheet. When I enter anything within the added columns it works fine. But when the sheet auto fills from the other linked sheets it doesn’t update. I manually have to enter it. WHY?

chris neilsen
  • 52,446
  • 10
  • 84
  • 123

1 Answers1

-1

IMHO, if you set the concrete range like Set MyDataRng = Range ("A2:A10") Why are you using "Offset" function except of setting the value you need to column B in concrete cell?

Dim a As Long
a=Target.Row
Cells(a,2)= Now

or just so

Cells(Target.Row,2)= Now

Offset is used when you have dynamic source range. And when you have exact Target range, you can write an offset address from Target

IvanSTV
  • 242
  • 1
  • 10