Results 1 to 5 of 5

Deleting Shapes

Threaded View

  1. #1
    Registered User
    Join Date
    09-20-2011
    Location
    Belfast
    MS-Off Ver
    Excel 2007
    Posts
    34

    Deleting Shapes

    Hello all!

    I have a macro that will add text boxes to a form template depending on the contents of cell D4:
    If Range("D4").Value = "OGD" Then
    ActiveSheet.OLEObjects.Add(ClassType:="Forms.TextBox.1", Link:=False, _
            DisplayAsIcon:=False, Left:=3.75, Top:=270, Width:=333.75, Height:= _
            62.25).Select
        Selection.Name = "1"
    It goes on to add another 6 text boxes to the template. If D4="FS" then it adds another 8 boxes. I want to be able to delete the boxes using a macro but can't work out how to tell it that if boxes 8 and 9 are there then delete them and if not then carry on. At the moment it gives me an error message if 8 and 9 aren't there.

    I have other shapes in there so I can't do delete all shapes.

    I hope that makes sense!

    Thanks,

    Dean
    Last edited by romperstomper; 11-25-2011 at 11:53 AM. Reason: code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1