PDA

View Full Version : Solved: Manipulating Activesheet Shapes?



Simon Lloyd
07-30-2007, 01:51 PM
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!

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

Simon Lloyd
07-30-2007, 02:09 PM
I solved the problem above like this, but can anyone explain why the former wont work?

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

Bob Phillips
07-30-2007, 03:15 PM
A shape copy doesn't support the Destination argument, in fact it doesn't have any.

rory
07-30-2007, 04:06 PM
For what it's worth, you also appeared to be trying to use i as a range, as well as an integer.
Regards,
Rory

Simon Lloyd
07-31-2007, 04:04 AM
Thanks for the replies!