Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default Check if shape exist

Hi Hans,

Better would be something like:

'==========
Public Sub Tester()
Dim SH As Worksheet
Dim SHP As Shape
Dim Rng As Range
Const sShape As String _
= "Rectangle 1" '<<==== CHANGE

Set SH = ThisWorkbook. _
Sheets("Sheet1") '<<==== CHANGE

With SH
Set Rng = Range("A2") '<<==== CHANGE
On Error Resume Next
Set SHP = .Shapes(sShape)
On Error GoTo 0

If SHP Is Nothing Then
Set SHP = .Shapes.AddShape _
(Type:=msoShapeRectangle, _
Left:=20, _
Top:=50, _
Width:=100, _
Height:=50)
End If
End With

'\\ your code, e.g.:
With SHP
.TextEffect.Text = Range("A1").Value
.Name = sShape
End With
End Sub
'<<==========



---
Regards.
Norman
Reply
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
Check for a tab if it is exist Farhad Excel Discussion (Misc queries) 2 December 21st 08 07:31 PM
How to check worksheets exist or not ? moonhk Excel Programming 0 November 16th 06 01:47 AM
Does Shape Exist? Alan Excel Programming 3 July 24th 06 01:36 PM
Check if a value exist in a column DJ Steffo Excel Worksheet Functions 1 January 30th 06 02:37 PM
Check if pivot already exist Tom Ogilvy Excel Programming 0 September 11th 03 05:43 AM


All times are GMT +1. The time now is 02:25 AM.

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

About Us

"It's about Microsoft Excel"