+ Reply to Thread
Results 1 to 2 of 2

Getting the value of a cell via defined name

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-14-2007
    Posts
    142

    Getting the value of a cell via defined name

    Sorry to trouble you with something so trivial.

    I have a workbook that contains a defined name (say, "MyName") which refers to a specific cell which contains a text string. The name is local to the worksheet containing that cell.

    I have a VBA routine in which I wish to assign to a variable (say "stMyString") (DIMmed as String) the value of the text string contained in the cell to which MyName refers. I need to do this by reference to the defined name, not by reference to the cell itself, whose reference might change between separate instances of running the macro.

    What is the syntax for that assignment statement, please?

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,661

    Re: Getting the value of a cell via defined name

    Sheets("sheet1").Range("B6").Value = Sheets("sheet1").Range("mytest").Value
    Ben Van Johnson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1