Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6068107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:40:49+00:00 2026-05-23T09:40:49+00:00

I am using Excel application SheetChange event to capture any change in my Excel

  • 0

I am using Excel application SheetChange event to capture any change in my Excel app sheets.
if a user modifies only 1 cell, then retrieving the cell coordinates can be done via:

void CellsChange(object Sh, Excel.Range Target)
{
 ....
 string changedCell = Target.get_Address(Missing.Value, Missing.Value, Excel.XlReferenceStyle.xlA1, Missing.Value, Missing.Value);
 ....
}

In the above example a typical return value is “$C$11”.

But if a user modifies a range of cells by highlighting more than one cell, and using shift-enter to fill the whole range with the same value, the returned string can be something like: “$C$11:$K$11” (indicating a 9 cell in-a-row change).

How can i iterate throw the range? getting each cell coordinate and value in a foreach or for loops.
I tried the following…

for (int i = 0; i < Target.Count; i++)
{
   Excel.Range r = Target.Item[i];
   MessageBox.Show(Convert.ToString(r.Value2));
}

but this code is not giving me the original range cells new value.
I also didn’t follow the Target.Item logic – is it zero based array or one based array.
On few tries it looked like the Item array is the whole sheet cell range formated as array (thus Item[0] can be used as well, which is one cell to the left of the highlighted range).

Does anyone have more experience using the Range object and/or the above event?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:40:49+00:00Added an answer on May 23, 2026 at 9:40 am

    Since you are already getting the Range object in your event handler, you don’t want to re-query the worksheet for your range–you won’t get the new values.

    Instead, try looping through the Range.Cells property, like this:

    foreach (Range c in Target.Cells)
    {
       string changedCell = c.get_Address(Type.Missing, Type.Missing, XlReferenceStyle.xlA1, Type.Missing, Type.Missing);  
       MessageBox.Show("Address:" + changedCell + " Value: " + c.Value2);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I mannually terminate an excel application using OLE Automation? I would like
I am using a Windows application for exporting a data table to Excel. It's
I am using a Windows application and I export a datatable into an Excel
I am using Excel where certain fields are allowed for user input and other
Any idea where the setting is hiding for turning gridlines off while using excel
Trying to get a reference to the worksheets (using Excel interop): Excel.Application xl =
I'm using the Excel.Application COM object from a Python program to open a CSV
I am reading a cell value from excel using named range in my case
I'm using (Excel.Application)Marshal.GetActiveObject(Excel.Application) It returns me a _ComObject type but I was wondering how
I am using this in Script Component In SSIS --> Microsoft.Office.Interop.Excel.Application objXL = new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.