Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2006, 07:15 AM
Registered User
 
Join Date: Nov 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default selecting named ranges from an array

Hi

I have an array of strings representing named ranges. I want to use these strings to select the ranges like this:

Range(rangeNames(i) ).Select

but it generates an error. Am I on the right track or is this type of operation impractical or impossible in VBA?

Thanks in advance
 
Old November 13th, 2006, 07:35 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Just prefiz the Range with the Sheet Object

Like

Activesheet.Range(rangeNames(i) ).Select

or

Worksheets(1).Activesheet.Range(rangeNames(i) ).Select

It should work

Cheers
Shasur

http://www.vbadud.blogspot.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing Workbook Named Ranges in VBA RollingWoodFarm Excel VBA 2 October 4th, 2006 01:54 PM
Drop Down boxes in Cells and selecting ranges tbmbob Excel VBA 0 June 1st, 2006 09:12 AM
Date Ranges nbuckwheat Access 1 December 12th, 2005 12:45 PM
selecting multiple records as one record array Greywacke Classic ASP Databases 1 February 10th, 2004 10:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.