Consulting

Results 1 to 5 of 5

Thread: Solved: Manipulating Activesheet Shapes?

  1. #1
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location

    Solved: Manipulating Activesheet Shapes?

    Hi all, i am trying to simply copy a shape over a range using the very simple macro below, i must admit i havent done any vba for around 2 months now so may be missing something simple, but when i run the code i get error 1004 Application - defined or object defined error!.....i cant seem to rectify it......a nudge in the right direction please!
    [VBA]
    Sub Macro2()
    Dim i As Integer
    For i = Range("G16") To Range("G2992") Step 12
    ActiveSheet.Shapes("Oval 6990").Copy Destination:=i
    Next
    End Sub
    [/VBA]
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  2. #2
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    I solved the problem above like this, but can anyone explain why the former wont work?
    [VBA]
    Sub Macro2()
    Dim i As Integer
    For i = 16 To 2992 Step 12
    ActiveSheet.Shapes("Oval 6990").Select
    Selection.Copy
    Range("G" & i).Select
    ActiveSheet.Paste
    Next
    End Sub
    [/VBA]
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    A shape copy doesn't support the Destination argument, in fact it doesn't have any.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    For what it's worth, you also appeared to be trying to use i as a range, as well as an integer.
    Regards,
    Rory

  5. #5
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Thanks for the replies!
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

Posting Permissions

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