Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Check for a shape - then change or delete it if it exists

I have a spreadsheet which contains lines that have been drawn using vba.
During the drawing the process they are named like this myLine.Name = "Arrow"
& CStr(PasteRow). The variables "myline" (shape object) and "pasterow" (long
number)have been declared and defined. When content on the spreadsheet
changes the arrows' positions and lengths can be affected, or they may be
deleted if no longer needed. I need to search to see if an arrow exists,
change it and or delete it. What do you suggest (using Excel 2003 SP2)?

--
Thanks!
Mona-ABE
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Check for a shape - then change or delete it if it exists

Dim myShape
if ActiveSheet.shapes.count0 then
for each myShape in ActiveSheet.shapes
if myShape.name = "Arrow" then

'stick code in here for the actions you want to take once
this shape has been found

end if
next
end if


Not sure if the above helps - but maybe its a start
J




On 30 May, 14:25, Mona-ABE wrote:
I have a spreadsheet which contains lines that have been drawn using vba.
During the drawing the process they are named like this myLine.Name = "Arrow"
& CStr(PasteRow). The variables "myline" (shape object) and "pasterow" (long
number)have been declared and defined. When content on the spreadsheet
changes the arrows' positions and lengths can be affected, or they may be
deleted if no longer needed. I need to search to see if an arrow exists,
change it and or delete it. What do you suggest (using Excel 2003 SP2)?

--
Thanks!
Mona-ABE



  #3   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 145
Default Check for a shape - then change or delete it if it exists

dim s

on error resume next
set s=activesheet.shapes(shapename)
on error goto 0

if not s is nothing then
.... do something with s
end if

Tim


"Mona-ABE" wrote in message
...
I have a spreadsheet which contains lines that have been drawn using vba.
During the drawing the process they are named like this myLine.Name =
"Arrow"
& CStr(PasteRow). The variables "myline" (shape object) and "pasterow"
(long
number)have been declared and defined. When content on the spreadsheet
changes the arrows' positions and lengths can be affected, or they may be
deleted if no longer needed. I need to search to see if an arrow exists,
change it and or delete it. What do you suggest (using Excel 2003 SP2)?

--
Thanks!
Mona-ABE



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 if a File Exists Ray Clark[_2_] Excel Programming 4 June 11th 08 05:13 PM
verify a shape exists in the sheet vandaley Excel Programming 3 October 29th 06 12:22 PM
Check if filename exists. Darrin Henshaw Excel Programming 6 May 5th 05 11:59 PM
How to check if the directory exists? ira Excel Programming 2 January 19th 04 01:22 PM
Check whether a worksheet exists already clui[_6_] Excel Programming 2 December 3rd 03 05:19 PM


All times are GMT +1. The time now is 11:44 PM.

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"