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 7662261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:45:19+00:00 2026-05-31T13:45:19+00:00

To get named range of a cell, heres my code. Works ok if the

  • 0

To get named range of a cell, heres my code. Works ok if the clicked cell is on first sheet. But the moment I select a cell from some other sheet, it just throws the Exception from HRESULT: 0x800A03EC Error

Saw similar question on stack but dint get the conclusion from those posts:
Here is my code:

            Microsoft.Office.Interop.Excel.Workbook _workbook = ThisAddIn.Application.ActiveWorkbook;

            Microsoft.Office.Interop.Excel.Range Target = (Microsoft.Office.Interop.Excel.Range)Globals.ThisAddIn.Application.ActiveCell;
            foreach (Microsoft.Office.Interop.Excel.Name name in _workbook.Names)
            {
                Microsoft.Office.Interop.Excel.Range intersectRange = _workbook.Application.Intersect(Target, name.RefersToRange);
                if (intersectRange != null)
                {
                    rangeName = name.Name;
                    break;
                }
            }
  • 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-31T13:45:20+00:00Added an answer on May 31, 2026 at 1:45 pm

    You can’t use Intersect without throwing an error if the ranges are on different sheets. Add a check to see whether each range’s Parent property refer to the same sheet, before you try the Intersect()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's some code, k.Bind<IGame>().To<Game>().Named(A) .WithConstructorArgument(ColorChoiceCount, 12); iGame = k.Get<IGame>(A); ((Game)iGame).SelectedColor = new GameColor(System.Drawing.Color.Red); iGame
I am reading a cell value from excel using named range in my case
Is it possible to select a specific cell in a named range. I would
In my project ,I get json data from Server,there's a field named 'creat_at' in
I wrote code to get name of printer which is installed in my system.but
I have something of the following : Sheet 1 (Name Range : Code) Column
i have the following code: It is supposed to go into a sheet named
To get windows service named MyTestService I create an instance of Win32_Service object then
My table named pictures has a column named pic and I'm wanting to get
hi i have property named. public bool ShowLabels{get; set;} and one toolbar menu button

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.