Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple cell selection on one click! | Excel Discussion (Misc queries) | |||
How to use selection change instead of double click event? | Excel Discussion (Misc queries) | |||
Cancelling Cell Selection using ctrl + click | Excel Discussion (Misc queries) | |||
[pivottables] multiple table selection fields update in one click... | Excel Discussion (Misc queries) |