Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting Multiple Non Cotiguous Cells (in a column)

Status
Not open for further replies.

tsosiel

Programmer
Aug 10, 2001
42
US
Greetings.

I'm trying to write code that will detect if a user selected more than 1 cell in a column! I tried using the Selection action - this allows me to determine if more than 1 cell is selected. However, I don't know how to get which cells are selected from this? Can anyone help me? I'd like to extract any data that is one column to the right of these selected cells.

Thank you for any assistance.

- Lorentz
 
Run and study this example:
Code:
Option Explicit
Sub TEST()
Dim r As Range
  For Each r In Selection
    MsgBox "Selected: " + r.Address _
      + "  Neighbor: " + r.Offset(0, 1).Address
  Next r
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top