ActiveCell.Row -

AC PORTA VIA

Board Regular
Joined
Apr 9, 2016
Messages
235
Office Version
  1. 365
Platform
  1. Windows
Hi, i am having hard time to understand active cell offset
Why does the below code offset to different row on different computers
Code:
If Not Intersect(Target, Range("C1:C1000")) Is Nothing Then
Application.EnableEvents = False 
Cells(ActiveCell.Row - 0, 11) = Now
if My active cell is E3 above code Should put date in K3
However on the one computer it does on the other it selects K4
i am running office 2007 on both computers
Than you!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Try this instead

Code:
If Not Intersect(Target, Range("C1:C1000")) Is Nothing Then
   Application.EnableEvents = False 
   Cells(Target.Row , "K") = Now

ActiveCell is where the cursor ends up
- some users have Excel set up for next cell down to be selected after entering value in cell
- others have the next to the right selected etc

Using Target (which triggered the macro) should give the correct and consistent row
 
Last edited:
Upvote 0
Solution
I tried both codes but none works correct
i have created new file with below code and still puts date in one row below
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    
If Not Intersect(Target, Range("c1:c1000")) Is Nothing Then
Application.EnableEvents = False
ActiveCell.Offset(0, 6) = Now
End If
Application.EnableEvents = True
End Sub
 
Upvote 0
Does the message box below give you what you expect for the Active cell?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    
If Not Intersect(Target, Range("c1:c1000")) Is Nothing Then
Application.EnableEvents = False
MsgBox ActiveCell.Address
ActiveCell.Offset(0, 6) = Now
End If
Application.EnableEvents = True
End Sub
 
Upvote 0
I got it working using below code
Code:
  Cells(Target.Row , "K") = Now
Thanks YONGLE
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top