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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:21:58+00:00 2026-05-17T16:21:58+00:00

I have already a defined name for a particular column in my worksheet. How

  • 0

I have already a defined name for a particular column in my worksheet.
How to display a cell value by its defined name?

I’ve tried these:

  Public Sub Test()
    Dim R As Range
    Set R = ThisWorkbook.Names("SomeName").RefersToRange
    MsgBox CStr(R.Value)
  End Sub

but run-time error occured “Type Mismatch” (error code: 13).

What’s wrong with the code?
What is the actual data type of RefersToRange.Value?

The documentation says that RefersToRange returns the Range object, but it seems differ with the Range object returned by ActiveCell, because I’ve no problem with the following code:

  MsgBox CStr(ActiveCell.Value)

I’ve been using Excel 2003

  • 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-17T16:21:59+00:00Added an answer on May 17, 2026 at 4:21 pm

    RefersToRange does return a Range object. I assume you’re getting your Type Mismatch on the Cstr line. If the range has multiple cells, the Value property returns a Variant array. Do this in the Immediate Window (Control+G in the VBE).

    ?typename(thisworkbook.Names("SomeRange").RefersTorange)
    Range
    ?typename(thisworkbook.Names("SomeRange").RefersToRange.Value)
    Variant()
    

    The CStr function can’t handle an array argument and that’s why you’re getting that error. You can get to a particular cell in the range, like the first cell, like this

    ThisWorkbook.Names("SomeRange").RefersToRange(1).Value
    

    Or loop through them as Fink suggests.

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

Sidebar

Related Questions

i have a object in javascript and some already defined functions. but how can
I have a Java array defined already e.g. float[] values = new float[3]; I
I have already tried multiple ways. defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ORGANIZATIONNAME=YourNameHere;}' Also i've tried
I have already some applets ready. I tried to run it on android tablet.
I have already Fetched the name of location through coordinates. with this code reverseGeocoder
I have a book PHP website that uses URL Rewriting rules already defined on
I have a PHP website about books that uses URL Rewriting rules already defined
Let's say I already have near 2000 lines like these: <div style=position:absolute;top:461;left:167><nobr>1 001 A
I have already pushed all the changes to the server. Here is the order
I have already download and install this package to support HTML5 input type http://support.microsoft.com/kb/2468871

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.