Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group Lines in Excel?

Status
Not open for further replies.

Drile

Technical User
Jan 5, 2007
5
SI
Hello

I already posted this problem, but I'm still struggling with my code. So I will make my problem a little different (Raypayette, thank you for you answer’s):
How should I group the first 50 from 100 lines on the Sheet1. I know that I can:
ActiveSheet.Shapes.Range(Array("Line 6", "Line 5"....)).Select
Selection.ShapeRange.Group.Select

But what if I won't work with Shape’s Names (“Line 6”...). It is difficult to loop through them-Shape’s Names. I know that there is the second way to work with Shape Objects (Lines,…): that is Index Number. I think that I can easilly loop with Index Numbers rather than with Shape’s Names. OK, but I don’t know how to get their Index Numbers. Excel assigned them a default value (on a first come first serve basis, even for deleted shapes).
Maybe I make my problem unclear, so I will simplify it:
Which is the most effective way to loop through Shape Objects (Lines). Select and then group them. Any suggestions.

Thank you in advance

Drile
 

Drile,

We don't know what you previously posted. We don't have your code.

YOU know what you are referring to. WE do not.

Please restate your problem.

Be CLEAR, CONCISE and COMPLETE.

Skip,

[glasses] [red][/red]
[tongue]
 
Sorry to be unclear, inconcised...I hope that this code will help you:

Dim n_Rows_LINE As Integer
dim Group as String
dim Layerji_Array() as Variant
For n_Rows_LINE = 1 To 50
Group = """" & n_Rows_LINE & """"
ReDim Preserve Layerji_Array(n_Rows_LINE)
Layerji_Array(n_Rows_LINE) = Group 'Fill the Array with Lines Names
Next n_Rows_LINE
ActiveSheet.Shapes.Range(Layerji_Array).Select


With this code I wan't to select first 50 lines. I hope that I'm on the right way?

Drile
 



" I wan't to select first 50 lines"
Code:
dim lFirstRow as long, lLastRow as long
lfirstrow = 1
llastrow = 50
range(lfirstrow & ":" & llastrow).select





Skip,

[glasses] [red][/red]
[tongue]
 
If I summarize my problem:
How should I on the most effective way select first 50 from 100 shapes (ie. lines). I can't find out the right code.

Drile
 
Thank you Skip, you relived me!
 



Having selecgted the first 50 rows, what do you intend to do with this selection?

Will it ALWAYS be the first 50 rows?

Skip,

[glasses] [red][/red]
[tongue]
 
I tryed your code but we misunderstood. Your code select the first 50 Rows on the Sheet1, but I wan't to select first 50 Lines (Shape Objects). Lines were draw with: ActiveSheet.Shapes.AddLine(BeginX, Beginy, EndX, EndY)
Any suggestion?

Drile
 



OK, having selected the first 100 LINES, what will you do with that selection?

Skip,

[glasses] [red][/red]
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top