VBA and shapes, man! It's all about the shapes!

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
788
Office Version
  1. 2010
Platform
  1. Windows
Hi ladies and gents.

I have a sheet with various metrics on it (15 in total)

According to the variance from last month, these will either have a RedUp, RedDown, GreenUp, GreenDown or GreySame box with an inside arrow (grouped shapes)

Don't worry too much about that, I will have to do it line by line for each of the 15 metrics and work out is it a profit increase (green up) a cost increase (red up) etc, that sort of thing.




I have these five grouped shapes sat in the top of the worksheet, and when I need one, I want to duplicate it, and then move that named version into place. But first, I need to delete all shapes that aren't the original five.

Here's what I have so far:

VBA Code:
Set s = ActiveSheet.Shapes("RedUp")

Set s = s.Duplicate


With s
    .Top = Range("B9").Top
    .Left = Range("C9").Left - 27.5
End With

The problem here is that when I duplicate the shape, it retains the original name of "RedUp" - it would be good to call it "RedUpCopy" and then at the start of the module I can simply purge any shapes that have "copy" in the name.

Thanks! Leslie, there's not a single shape in that painting!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Ah! This looks promising:

VBA Code:
Set s = ActiveSheet.Shapes("RedUp")

With s.Duplicate
    .Name = s.Name & "Copy"
    .Top = Range("B9").Top
    .Left = Range("C9").Left - 27.5
End With
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,809
Members
449,048
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top