ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet change code (https://www.excelbanter.com/excel-programming/305147-worksheet-change-code.html)

Frank Kabel

Worksheet change code
 
Hi Todd

try
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim Counter As Long
Dim Location

Counter = Application.WorksheetFunction.CountA(me.Range
("K:K"))

On Error Resume Next
Set myRange = Intersect(Range("K2:K" & Counter), Target)
If Not myRange Is Nothing Then
target.Offset(0, 15).Select
SendKeys "%{down}"
End If
End Sub


-----Original Message-----
hey guys

Below is a code that is supposed to sendkeys to a certain
cell if a change is made in the specified range.

However,
it does not work. Can anyone tell me whats wrong? When

I
change a cell in the specified cells, nothing happens.

If
I change the event to the worksheet_SelectionChange, it
works but it never gives me the chance to enter anything
into the cell I want to.

Can anyone tell me whats wrong?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim Counter As Long
Dim Location

Counter = Application.WorksheetFunction.CountA(Worksheets
(1).Range("K:K"))
Location = ActiveCell.Address

On Error Resume Next
Set myRange = Intersect(Range("K2:K" & Counter), Target)
If Not myRange Is Nothing Then
Range(Location).Offset(0, 15).Select
SendKeys "%{down}"
End If
End Sub


Thanks
Todd Huttenstine
.


Todd huttenstine

Worksheet change code
 
Ah yes, thank you.

Todd
-----Original Message-----
Hi Todd

try
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim Counter As Long
Dim Location

Counter = Application.WorksheetFunction.CountA(me.Range
("K:K"))

On Error Resume Next
Set myRange = Intersect(Range("K2:K" & Counter), Target)
If Not myRange Is Nothing Then
target.Offset(0, 15).Select
SendKeys "%{down}"
End If
End Sub


-----Original Message-----
hey guys

Below is a code that is supposed to sendkeys to a

certain
cell if a change is made in the specified range.

However,
it does not work. Can anyone tell me whats wrong? When

I
change a cell in the specified cells, nothing happens.

If
I change the event to the worksheet_SelectionChange, it
works but it never gives me the chance to enter anything
into the cell I want to.

Can anyone tell me whats wrong?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim Counter As Long
Dim Location

Counter = Application.WorksheetFunction.CountA(Worksheets
(1).Range("K:K"))
Location = ActiveCell.Address

On Error Resume Next
Set myRange = Intersect(Range("K2:K" & Counter), Target)
If Not myRange Is Nothing Then
Range(Location).Offset(0, 15).Select
SendKeys "%{down}"
End If
End Sub


Thanks
Todd Huttenstine
.

.



All times are GMT +1. The time now is 05:47 PM.

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