Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 262
Default What cell caused the worksheet change event

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default What cell caused the worksheet change event

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default What cell caused the worksheet change event

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default What cell caused the worksheet change event

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 262
Default What cell caused the worksheet change event

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet Change Event - copy cell to another sheet dhstein Excel Discussion (Misc queries) 2 October 12th 09 06:35 PM
change event on specific cell rather than worksheet frendabrenda1 Excel Discussion (Misc queries) 10 September 21st 06 03:37 AM
Cell value change to trigger macro (worksheet change event?) Neil Goldwasser Excel Programming 4 January 10th 06 01:55 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM


All times are GMT +1. The time now is 07:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"