Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Cannot find array

Posted on 2016-11-08
2
Medium Priority
?
47 Views
Last Modified: 2016-11-08
I have received a workbook to debug.  Execution of the code stops on the following line with the error message it cannot be found.
ActiveSheet.Shapes.Range(Array("HomeLay")).Select

Below is a list of all shapes on the active page.
Shape Name      Shape Type
Group 125      Group 125
Group 126      Group 126
Group 127      Group 127
Group 128      Group 128
Picture 1      Picture 1
TextBox 102      TextBox 102
Picture 34      Picture 34
TextBox 33      TextBox 33

Any idea what is going on here?
0
Comment
Question by:rrhandle8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 2000 total points
ID: 41879758
The code you have provided is attempting to select a range of one shape with the name of "HomeLay". If there are no shapes named that then you will get the error you reported. The Shapes.Range method typically is used to select multiple shapes by specifying the name of each in the Array function...

ActiveSheet.Shapes.Range(Array("Group 125", "Group 126", "Picture 1")).Select

Open in new window


Incidentally, this line...

ActiveSheet.Shapes.Range(Array("HomeLay")).Select

Open in new window


...performs the same action as this...
ActiveSheet.Shapes.("HomeLay").Select

Open in new window

0
 

Author Closing Comment

by:rrhandle8
ID: 41879768
Exactly what I suspected, but I needed some confirmation. Thank you!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question