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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:55:31+00:00 2026-06-12T23:55:31+00:00

I am using the Name Object to create constants that I’m using in calculations

  • 0

I am using the Name Object to create constants that I’m using in calculations on my worksheets. My problem is that I need to use these same constants in Macros, but can’t seem to create an integer – they keep coming through as strings.

A piece of my code looks like this:

Private Sub Workbook_Open()

    'intDocRows
    ActiveWorkbook.Worksheets("INV").Names.Add Name:="intDocRows", RefersToR1C1 _
        :=16
    ActiveWorkbook.Worksheets("INV").Names("intDocRows").Comment = ""

End Sub

Then I need to use this value in a calculation, but it keeps coming through as “=16” instead of 16 in both of the instances below.

ThisWorkbook.ActiveSheet.Names("intDocRows").Value
ThisWorkbook.ActiveSheet.Names("intDocRows").RefersTo

All help is appreciated. Thanx.
It works fine if I use it in a cell though… it’s just in the Macro that I’m having issues.

  • 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-12T23:55:32+00:00Added an answer on June 12, 2026 at 11:55 pm

    You could use Evaluate(ThisWorkbook.ActiveSheet.Names("intDocRows").Value) in your macro code which is simpler than your method. Or even just Evaluate(Names("intDocRows").Value) unless you have the same name scoped on more than one of your worksheets.

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

Sidebar

Related Questions

I need to Find Previous month name using Calender or any classes that in
How do I access the name of an item in an Object Literal using
When we define routes in routes.rb using the name like map.some_link .We can use
Code to create new form instance of a closed form using form name I
I don't know any Objective-C, that is why I'm using PhoneGap to create an
I have a using statement defined like this in codebehind: using Name = Extremely.Long.And.Unwieldy.Namespace
Using class name I am firing a click event in jquery. Class names are
I want to get the class name using jQuery And if it has an
How can I in change the table name using a query statement? I used
How can I retrieve the XML source file name using XSL 1.0 code?

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.