View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Identifying the Selected Cell

If you use the Worksheet_Change event the changed cell is passed toi the
event procedure as a parameter.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
'do your stuff
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

In this example, Target refers to the cell changed.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Warderbrad" wrote
in message ...

I am needing a set of code to run when a range of cells have one of them
changed, and I am not sure how to event this.

I had thought to use a Selection_Change event but I am still not sure
how to tell what cell is/was selected. Is there a standard command to
retrieve the address of either the newly selected cell or the one being
moved away from?


--
Warderbrad
------------------------------------------------------------------------
Warderbrad's Profile:

http://www.excelforum.com/member.php...o&userid=28169
View this thread: http://www.excelforum.com/showthread...hreadid=487652