Try this. I'm out of time now but will take a look tomorrow if problems persist. I got a strange error on the .Left lines
Sub groupshapes()
Dim myshape As Shape, v1(), v2(), v3(), i As Long, j As Long, k As Long
Dim a, b, c, d, e
a = Range("P1").Left
b = Range("Q1").Left
c = Range("AF1").Left
d = Range("AH1").Left
e = Range("AV1").Left
For Each myshape In ActiveSheet.Shapes
myshape.Select
Select Case myshape.Left
Case 0 To a
i = i + 1
ReDim Preserve v1(1 To i)
v1(i) = myshape.Name
Case b To c
j = j + 1
ReDim Preserve v2(1 To j)
v2(j) = myshape.Name
Case d To e
k = k + 1
ReDim Preserve v3(1 To k)
v3(k) = myshape.Name
End Select
'If Object.Top > Range("A27").Left Then Group = Group + 3 - have not catered for this line as not sure what it should do
Next myshape
With ActiveSheet.Shapes
On Error Resume Next
.Range(v1).Group
.Range(v2).Group
.Range(v3).Group
End With
End Sub
Bookmarks