Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Named Ranges and Arrays help!

  1. #1
    New Member
    Join Date
    Apr 2002
    Location
    Chicago
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    What is the syntax to put a range in a variable from an array of names?

    I have an array where I am storing the names of certain ranges, now I want to use them, I can't figure out how to do it!!

    dim myRange as Range
    myRange = Range(myArray(i))

    The above won't work?! myArray is a string array and i could be 1 here. What is the proper syntax.

  2. #2
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Location
    Denver, Colorado USA
    Posts
    4,239
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Jimijon,

    You must use the Set keyword because a range is an object, and myRange is therefore a Range object variable. So...

    dim myRange as Range
    Set myRange = Range(myArray(i))




    Keep Excelling.

    Damon

    VBAexpert Excel Consulting
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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