• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2469
  • Last Modified:

Identify Selected Cells in Excel using C#

I am writing a C# addin for Excel.

I would like to get the currently selected cells in Excel so that I can perform some action using the values in those cells.

How can I get the currently selected cells into a Microsoft.Office.Interop.Excel.Range object (or something else suitable)?  I've tried using the Worksheet.UsedRange object but it's not quite right.
0
openshac
Asked:
openshac
1 Solution
 
Wayne Taylor (webtubbs)Commented:
Use Application.Selection()

Wayne
0
 
openshacAuthor Commented:
Got it.

I just use (Range)applicationObject.Selection
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now