Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to run a routine on my worksheet when the change event happens. This
event requires me to know the row and column of the cell that was changed, but if the user pressed return to complete the entry them the cursor moved down the the next row and if they press the Tab key it moves to the next column. Is there any way to find out which cell was changed? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Worksheet_Change has one argument and that is Target which is the range that
was changed so this should work for you... Private Sub Worksheet_Change(ByVal Target As Range) MsgBox Target.Column & " - " & Target.Row End Sub You might be thinking of selection change where target returns the currently selected range. -- HTH... Jim Thomlinson "Keith" wrote: I want to run a routine on my worksheet when the change event happens. This event requires me to know the row and column of the cell that was changed, but if the user pressed return to complete the entry them the cursor moved down the the next row and if they press the Tab key it moves to the next column. Is there any way to find out which cell was changed? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you can set the last range to a static value
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Static OldRange As Range dim i as integer dim j as integer if not OldRange is nothing then i = OldRange.row j = OldRange.column end if set OldRange = Target End Sub Keith wrote: I want to run a routine on my worksheet when the change event happens. This event requires me to know the row and column of the cell that was changed, but if the user pressed return to complete the entry them the cursor moved down the the next row and if they press the Tab key it moves to the next column. Is there any way to find out which cell was changed? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ignore my post I thought you were asking about the SheetSelectionChange
event. bobbo wrote: you can set the last range to a static value Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Static OldRange As Range dim i as integer dim j as integer if not OldRange is nothing then i = OldRange.row j = OldRange.column end if set OldRange = Target End Sub Keith wrote: I want to run a routine on my worksheet when the change event happens. This event requires me to know the row and column of the cell that was changed, but if the user pressed return to complete the entry them the cursor moved down the the next row and if they press the Tab key it moves to the next column. Is there any way to find out which cell was changed? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That was exactly wat I was looking for.
Thanks Jim. "Jim Thomlinson" wrote: Worksheet_Change has one argument and that is Target which is the range that was changed so this should work for you... Private Sub Worksheet_Change(ByVal Target As Range) MsgBox Target.Column & " - " & Target.Row End Sub You might be thinking of selection change where target returns the currently selected range. -- HTH... Jim Thomlinson "Keith" wrote: I want to run a routine on my worksheet when the change event happens. This event requires me to know the row and column of the cell that was changed, but if the user pressed return to complete the entry them the cursor moved down the the next row and if they press the Tab key it moves to the next column. Is there any way to find out which cell was changed? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Worksheet Change Event - copy cell to another sheet | Excel Discussion (Misc queries) | |||
change event on specific cell rather than worksheet | Excel Discussion (Misc queries) | |||
Cell value change to trigger macro (worksheet change event?) | Excel Programming | |||
Change Cell from Validated List Not Firing Worksheet Change Event | Excel Programming |