Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
multi cells selected
Can I tell if multi cells are selected? And can I get each cell?
So if i click A1 Ctrl+click D1 Ctrl+click G1 Can I get each of these cells? thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
multi cells selected
On Feb 28, 1:54 pm, "greg" wrote:
Can I tell if multi cells are selected? And can I get each cell? So if i click A1 Ctrl+click D1 Ctrl+click G1 Can I get each of these cells? thanks Hello Greg, The Range object has an Areas collection property. If you select a single cell or a contiguous range of cells then Areas.Count = 1. Here is a code snippet to display what Ranges you have selected in message box. Sub ShowRanges() Dim Msg As String Dim Rng As Range For Each Rng In Selection.Areas Msg = Msg & Rng.Address & vbCrLf Next Rng MsgBox "You selected the following ranges..." & vbCrLf & Msg End Sub Sincerely, Leith Ross |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
multi cells selected
thanks!
that worked "Leith Ross" wrote in message ... On Feb 28, 1:54 pm, "greg" wrote: Can I tell if multi cells are selected? And can I get each cell? So if i click A1 Ctrl+click D1 Ctrl+click G1 Can I get each of these cells? thanks Hello Greg, The Range object has an Areas collection property. If you select a single cell or a contiguous range of cells then Areas.Count = 1. Here is a code snippet to display what Ranges you have selected in message box. Sub ShowRanges() Dim Msg As String Dim Rng As Range For Each Rng In Selection.Areas Msg = Msg & Rng.Address & vbCrLf Next Rng MsgBox "You selected the following ranges..." & vbCrLf & Msg End Sub Sincerely, Leith Ross |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
multi cells selected
But you still could get the address of each cell in the selection:
Dim myCell as range for each mycell in selection.cells msgbox mycell.address(0,0) next mycell and you can check with this kind of code. if selection.cells.count 1 then 'multiple cells selected end if if selection.areas.count 1 then 'multiple areas selected end if greg wrote: Can I tell if multi cells are selected? And can I get each cell? So if i click A1 Ctrl+click D1 Ctrl+click G1 Can I get each of these cells? thanks -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple cells or columns are selected instead of selected cell or | Excel Discussion (Misc queries) | |||
Cells are selected but aren't displayed as selected | Excel Discussion (Misc queries) | |||
Cells are selected but aren't displayed as selected | Excel Worksheet Functions | |||
Last list item selected in a Multi-Select list box? | Excel Programming | |||
Macro to take selected cells times a selected cell | Excel Programming |