Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Identifying the Selected Cell


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Identifying the Selected Cell


in selection change you can use this code:
for i=0 to target.count - 1
selectedRow=target(i).row +1
selectedColumn=target(i).column
next

I didn't try it but i think it's correct


--
antoka05
------------------------------------------------------------------------
antoka05's Profile: http://www.excelforum.com/member.php...o&userid=29024
View this thread: http://www.excelforum.com/showthread...hreadid=487652

  #3   Report Post  
Posted to microsoft.public.excel.programming
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



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
Trouble identifying selected records richardwo Excel Discussion (Misc queries) 4 January 16th 07 01:48 PM
Identifying a Selected Range in a Macro DCSwearingen Excel Discussion (Misc queries) 4 April 25th 06 04:01 PM
Macro to take selected cells times a selected cell Craig Excel Programming 4 October 24th 05 12:54 AM
Identifying the selected Shape Jerry[_20_] Excel Programming 1 August 7th 05 07:15 AM
Identifying Multiple Selected Worksheets DavidMatthews Excel Programming 2 June 28th 04 08:33 PM


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

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

About Us

"It's about Microsoft Excel"