I want to move a shape when a user selects Yes or No from a dropdown list. I thought this would be simple, namely cut & paste the shape using VBA, but it does not seem to work that way.
Below image as a visual representation:
The objective is to bring the shape into view (cell CC18) when selected yes, and out of view (ideally on another sheet, but can also move to the same sheet) when select no.
I ran the
Macro Recorder and got the below code:
Sub Macro1() ' ' Macro1 Macro ' ' ActiveSheet.Shapes.Range(Array("shpAPEX")).Select Selection.Cut Range("CH18").Select ActiveSheet.Paste End Sub
Obviously this is not ideal, so I tried to translate that into something cleaner, namely:
But this does not work. It cuts the shape, but does not paste it. I can see this by finding the shape in the clipboard.
However, the below code works:
ws.Shapes("shpAPEX").Cut ws.Range("CC18").Select ActiveSheet.Paste
Can anyone please explain to me why my initial attempt does not work, and also what is the best way to move shapes between worksheets?