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

  • Home
  • SEARCH
  • 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 7803377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:33:47+00:00 2026-06-02T01:33:47+00:00

I am using NamedRanges to store Views of my Excel Sheet. So when a

  • 0

I am using NamedRanges to store “Views” of my Excel Sheet.
So when a user picks a View it will grab the NamedRange for that View (a collection of rows) it will then Hide those rows. However, it appears that when the actual Range in the NamedRange gets too big I am getting a COM Exception whenever I try to refer to the RefersToRange Property

‘(ViewRange).RefersToRange’ threw an exception of type
‘System.Runtime.InteropServices.COMException’

The really interesting part is that I can select the NamedRange in Excel and it will highlight the entire range just fine, also other properties like .RefersTo and .RefersToR1C1 return just fine.

I create the NamedRange by first creating a Range with all the Rows, and then just naming it.

here is an example of what is returned by RefersToR1C1 when I am getting the COM error

“=Sheet1!R13:R23,Sheet1!R26:R39,Sheet1!R41,Sheet1!R43:R46,Sheet1!R48:R49,Sheet1!R51:R72,Sheet1!R76:R78,Sheet1!R83:R84,Sheet1!R137:R147,Sheet1!R150:R163,Sheet1!R165,Sheet1!R167:R170,Sheet1!R172:R173,Sheet1!R175:R196,Sheet1!R200:R202,Sheet1!R207:R208,Sheet1!R261:R271,Sheet1!R274:R287,Sheet1!R289,Sheet1!R291:R294,Sheet1!R296:R297,Sheet1!R299:R320,Sheet1!R324:R326,Sheet1!R331:R332,Sheet1!R385:R395,Sheet1!R398:R411,Sheet1!R413,Sheet1!R415:R418,Sheet1!R420:R421,Sheet1!R423:R444,Sheet1!R448:R450,Sheet1!R455:R456”

Here is the code where I am having the problem

 Excel.Range rngAll = _Blocks.DataRange;
 rngAll.EntireRow.Hidden = false;
 Excel.Name ViewRange = Globals.ThisWorkbook.Names.Item(viewName, System.Type.Missing);

 string addy = ViewRange.RefersToR1C1 as string;   //this line works fine
 ViewRange.RefersToRange.EntireRow.Hidden = true;  //this line throws the COM Exception

Any help would be appreciated, or if you have a better way of accomplishing my “Views”, or is there a way even to use the Formula Address above to instantiate a range that I could then Hide?

UPDATE!!!

Ok So this doesn’t answer the original question, which is why I edited instead of answered. If there are reputable “Stack Overflowers” here please let me know if I should answer instead.

I did figure out a way to access the Range in question, which does solve my immediate problem. I ended up using the following line of code

Globals.Sheet1.InnerObject.get_Range(viewName, System.Type.Missing).EntireRow.Hidden = true;

Thanks,
Pete

  • 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-06-02T01:33:49+00:00Added an answer on June 2, 2026 at 1:33 am

    Still don’t know why it fails but the working solution is to access the Name Range via the Worksheet’s get_Range() method.

    Globals.Sheet1.InnerObject.get_Range(viewName, System.Type.Missing).EntireRow.Hidden = true; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a dynamic range using Excel functions that will sum
Using C#, I need a class called User that has a username, password, active
using chrome 15 on osx 10.6.8 When adding event listeners, I've found that putting
Using Browserlab, it appears that the background image is not centred in Firefox7 for
In Excel VBA, I am using Excel as datasource for some queries. I am
using Interface Builder and Storyboared, I built UITabBarController with 3 views. By default, when
I have generated a series of rows using C# and VSTO. I have basically
To recreate this problem: Create an Excel workbook (.xlsx). I'm using Excel 2010, but
using the arcsynthesis opengl tutorial and I'm trying to build the unofficial sdk that
Using the URL Rewrite module, I've got a rule setup that is defined as:

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.