ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet Change event - not running when down arrow is pressed (https://www.excelbanter.com/excel-programming/433860-worksheet-change-event-not-running-when-down-arrow-pressed.html)

Raj[_2_]

Worksheet Change event - not running when down arrow is pressed
 
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.

Dave Peterson

Worksheet Change event - not running when down arrow is pressed
 
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)

Raj wrote:

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.


--

Dave Peterson

Otto Moehrbach[_2_]

Worksheet Change event - not running when down arrow is pressed
 
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
"Raj" wrote in message
...
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.




Barb Reinhardt

Worksheet Change event - not running when down arrow is pressed
 
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

"Raj" wrote:

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.



All times are GMT +1. The time now is 11:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com