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: 17
Default Shape Name and Location Report - an example

No question here, just an example procedure for the archive.

Create a worksheet report for all Shapes found on the active worksheet.
The report shows the Shape names and top left corner cell locations for
the active worksheet

Sub ShapesReportForActiveSheet()

' Creates a worksheet report for all shape names and locations
'for the active worksheet

Dim ShapeCells As Range
Dim TargetSheet, ShapeSheet As Worksheet
Dim Row As Integer
Set TargetSheet = ActiveSheet

On Error Resume Next
''Check for presence of any shapes on active worksheet
If ActiveSheet.Shapes.Count = 0 Then
MsgBox "There are no Shapes present on this worksheet"
Exit Sub
End If

' If Shapes present, then identify location(s) of top left corner
of each Shape.
' and proceed with report

For Each sh In ActiveSheet.Shapes

If ShapeCells Is Nothing Then
Set ShapeCells = sh.TopLeftCell
Else
Set ShapeCells = Union(sh.TopLeftCell, ShapeCells)
End If

Next

'Add the report worksheet

Application.ScreenUpdating = False

Set ShapeSheet = ActiveWorkbook.Worksheets.Add
ShapeSheet.Name = "Location of Shapes in " & ShapeCells.Parent.Name

'Set up the column headings
With ShapeSheet

Range("A1") = "Shape Name"
Range("B1") = "Top Left Cell Address"
Range("A1:B1").Font.Bold = True

End With

TargetSheet.Activate

'Process each shape

Row = 2

For Each sh In ActiveSheet.Shapes

Application.StatusBar = Format((Row - 1) / ShapeCells.Count,
"0%")

ShapeSheet.Cells(Row, 1) = sh.Name
ShapeSheet.Cells(Row, 2) = sh.TopLeftCell.Address

Row = Row + 1

Next

'Adjust column widths
ShapeSheet.Columns("A:B").AutoFit
Application.StatusBar = False

ShapeSheet.Activate

Range("A2").Select

End Sub

Search criteria:
Shapes report return shape locations return shape names get shape names

 
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
Inserted Shape Prints in Different Location on Sheet Dave Excel Discussion (Misc queries) 0 April 22nd 08 01:00 AM
my curser changed from arrow shape to a cross shape???? bj New Users to Excel 1 February 5th 07 02:47 PM
Is it Possible to Find Shape at a Location (#find) for XL97? JK Excel Programming 4 March 16th 06 06:15 PM
Lock shape location to axis values? William DeLeo Charts and Charting in Excel 2 December 29th 05 01:09 PM
Find Value in Array and report on Location jC! Excel Programming 6 January 9th 04 01:26 AM


All times are GMT +1. The time now is 04:50 PM.

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"