PDA

View Full Version : Making an array that selects an increasing number of objects



T.granger
09-17-2015, 02:13 AM
Hi,

I'm doing some data analysis work where I generate new graphs for each month. Each graph is dated mm/yyyy and they are listed in columns by feature with the most recent graph being at the top.

Every time I create a new graph I want to move all the others down to fit in the newest chart at the top. I currently have code which does this; however it steps down each chart individually and since I am up to 25 charts per feature it takes a long time.

I was looking in to trying to select all the charts in the column and moving them down in one go by using an array to select them; however every time the program cycles I need to add the new chart name to the array to be selected and moved.

I have been trying to google how to add the new object to an array but I can't seem to understand it.

Any help would be great! thanks

snb
09-17-2015, 03:02 AM
If you want to sort on recency 'yyyy mm' is your friend, where 'mm yyyy' isn't.

T.granger
09-17-2015, 04:29 AM
If you want to sort on recency 'yyyy mm' is your friend, where 'mm yyyy' isn't.

The problem is that I'm not using that method to sort my charts.

I am simply moving all the existing charts down by 20 rows and inserting the newly created chart.

I just want to select all the charts in the column and step them down. I can't select all the charts in the sheet because there are others in other columns.

Thank you for your reply!

mikerickson
09-17-2015, 07:03 AM
Have you looked at Collections? rather than an array?

snb
09-17-2015, 08:23 AM
Sub M_snb()
ActiveSheet.Shapes.Range(Array("Chart 1", "Chart 4", "Chart 3")).IncrementTop 270
End Sub