Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Right click and iterate through selection

I want to drag a selection box around a group of cells in one column
(a5..a10) for example and then when the right-click is pressed give the user
the option to click "Process" and then iterate through each cell entry in the
range.

How do I do that? I 've got a fair idea for the right-click thing but I'm
not sure how to step through each cell in the range and process the numbers.

Thanks for any help
Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Right click and iterate through selection


Hello Paul,

Here is a code example that sums the values of the cells selected when
the user Right Clicks the selection. The sum of the Selected cells is
placed below the last cell in the selection.

Remember that setting Cnacel to True in this event will disable the
context menus.

EXAMPLE:


Code:
--------------------
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)

Dim Cell
Dim N

Cancel = True

For Each Cell In Selection
N = N + Cell.Value
Next Cell

Selection.Cells(1, 1).End(xlDown).Value = N

End Sub

--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=492446

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
Multiple cell selection on one click! v Excel Discussion (Misc queries) 3 January 5th 10 03:40 PM
How to use selection change instead of double click event? ghost Excel Discussion (Misc queries) 1 December 26th 08 04:58 AM
Cancelling Cell Selection using ctrl + click Robin R Excel Discussion (Misc queries) 3 December 2nd 07 12:34 AM
[pivottables] multiple table selection fields update in one click... [email protected] Excel Discussion (Misc queries) 1 September 22nd 06 02:42 AM


All times are GMT +1. The time now is 09:41 PM.

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"