I run into this issue a fair amount and am curious if someone can tell me why or how I can write this a little cleaner.
Below is my code and it does work.
If Target.Row = rTime.Offset(0, 1).Row Then
If Target.Column = rTime.Offset(0, 1).Column Then
cboStatus.Activate
End If
End If
How come I can’t just write it like this?
If Target = rTime.Offset(0, 1) Then
cboStatus.Activate
End If
If target is already a range then why do I need to specify the individual row and individual column? That second code will not work and I have tried many variations of it. I even tried something like If Target.Range = range(“C4”) Then
or If Target.Range = cells(4, 3) Then
, but neither of those worked either. I tried many variations of similar stuff. Although, I don’t want to use a specific range like A4
, since I wanted to use the rTime
like what is in the example, but I was just trying to figure this out.
Nothing seems to work, other than specifying the individual row and column each time. Can someone please explain this to me? Also, is there a better way to write this than what I did in the first example, which does work?
Thanks for anything that relieves my confusion.