PC Review


Reply
Thread Tools Rate Thread

What cell caused the worksheet change event

 
 
=?Utf-8?B?S2VpdGg=?=
Guest
Posts: n/a
 
      31st Oct 2006
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 With Quote
 
 
 
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      31st Oct 2006
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 With Quote
 
bobbo
Guest
Posts: n/a
 
      31st Oct 2006
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?


 
Reply With Quote
 
bobbo
Guest
Posts: n/a
 
      31st Oct 2006
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?


 
Reply With Quote
 
=?Utf-8?B?S2VpdGg=?=
Guest
Posts: n/a
 
      31st Oct 2006
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
worksheet change event only if cell was blank Sliman Microsoft Excel Programming 4 22nd Jun 2008 10:45 PM
Calculation of cell value with worksheet change event Raj Microsoft Excel Programming 2 30th May 2008 05:20 PM
change event on specific cell rather than worksheet =?Utf-8?B?ZnJlbmRhYnJlbmRhMQ==?= Microsoft Excel Misc 10 21st Sep 2006 03:37 AM
Cell value change to trigger macro (worksheet change event?) =?Utf-8?B?TmVpbCBHb2xkd2Fzc2Vy?= Microsoft Excel Programming 4 10th Jan 2006 01:55 PM
Change Cell from Validated List Not Firing Worksheet Change Event marston.gould@alaskaair.com Microsoft Excel Programming 3 4th Oct 2004 03:00 AM


Features
 

Advertising
 

Newsgroups
 


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