Worksheet Change event - not running when down arrow is pressed

R

Raj

Hi,

I am using the worksheet change event to run code when the value in a
cell in Column C is changed..

If Not Application.Intersect(Target, Me.Range("c2:c65536")) Is Nothing
Then
If Me.Cells(Selection.Row, 3).Value <> "" Then

Do this.....

End If
End If

The code runs if Enter key is pressed but will not run if the down
arrow key is pressed.

What can I do to make the code run when the arrow key is pressed?

Thanks in advance for the help.
 
D

Dave Peterson

The worksheet_change event will fire if you make a change. Using the arrow key
to travel down the column isn't making changes to the worksheet.

If you're trying to fix something that's already been entered, maybe using a
dedicated macro (run it once to fix the existing data) would be better.

ps. instead of using selection.row, I'd use target.row.

But since you're using the 3rd column, isn't:

me.cells(target.row,3).value the same as Target.value
(assuming a single cell was changed)
 
O

Otto Moehrbach

It works either way for me. When you press the down arrow- key, does the
active cell drop down? I'm thinking maybe you are using the down-arrow key
in the number pad (right side of the keyboard) with NumLock on. HTH Otto
 
B

Barb Reinhardt

Have you tried using the Worksheet_Selection change event? Also, I'd change
"C2:C65536" to "C2:C"& me.rows.count

in the line below.
if Not Application.Intersect(Target, Me.Range("c2:c65536")) Is Nothing

I'm guessing your code was written for Excel 2003.

HTH,
Barb Reinhardt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top