LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Using Arrays to select Shapes

I am having a problem building and then using an Array. Can anyone show me the errors of my way?

The following routine is called by another routine

Sub BuildArray(MyName)
On Error GoTo NotFound
If MyArray = "" Then
MyArray = MyName
Else
MyArray = MyArray & """, """ & MyName
End If
Exit Sub
NotFound:
Msg = "Selection is not on this Sheet."
Title = "Not Found"
Style = vbOKOnly
Response = MsgBox(Msg, Style, Title)
MyContinue = "No"
Exit Sub
End Sub


€œMyArray€ looks OK (i.e. €œI3890 150€, €œI3890 160€, €œI3890 170€). Then the calling routine tries to use the array as follows:
€¦
Worksheets(MySheet).Select
Worksheets(MySheet).Shapes.Range(Array(MyArray)).S elect
Selection.Cut
End Sub

But the result is Run-time error €œ1004€. €œThe item with the specified name wasnt found€.

If I substitute the actual value of €œMyArray€ (i.e. €œI3890 150€, €œI3890 160€, €œI3890 170€) in the calling program, it runs just fine. Whats with that?

Your assistance is greatly appreciated.

Don
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 - Select Multiple Shapes Barb Reinhardt Excel Discussion (Misc queries) 2 March 18th 09 03:17 PM
Select and Move Cursor Shapes marcopolo New Users to Excel 1 September 4th 08 06:40 AM
How Do I ... select multiple shapes in Excel 2007 (similar to 2003 Barb Reinhardt Excel Discussion (Misc queries) 1 July 30th 08 11:00 PM
When drawing shapes in excel the shapes keep disappearing Tape Excel Discussion (Misc queries) 1 October 6th 06 04:23 PM
Using arrays to select a series of cells [email protected] Excel Discussion (Misc queries) 1 December 27th 05 10:47 PM


All times are GMT +1. The time now is 03:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"