Hi,
I have a sheet with several shapes (100+) and I need to manipulate the transparency of each shape based on the text in each shape.
Currently I am using a For Loop to go through each shape to test if the text equals a specific string. If so, the shape transparency is modified.
However, I suspect that this is quite a cumbersome operation for VBA as it takes a few seconds to process each shape during the loop. I am wondering if it: a) is possible to add each shape matching the text criteria to a collection, and b) is possible to manipulate the shape transparency of each shape in the collection in order to speed it up.
Eventhough the following code will not work, it demonstrates what I'm trying to achieve:
Again, the purpose is to speed up the processing time so that VBA will apply the transparency modification in one sweep.
All suggestions/comments are welcome.
Thanks
I have a sheet with several shapes (100+) and I need to manipulate the transparency of each shape based on the text in each shape.
Currently I am using a For Loop to go through each shape to test if the text equals a specific string. If so, the shape transparency is modified.
However, I suspect that this is quite a cumbersome operation for VBA as it takes a few seconds to process each shape during the loop. I am wondering if it: a) is possible to add each shape matching the text criteria to a collection, and b) is possible to manipulate the shape transparency of each shape in the collection in order to speed it up.
Eventhough the following code will not work, it demonstrates what I'm trying to achieve:
Code:
dim shp as shape
dim colShapes as new collection
for each shp in activesheet.shapes
if shp.textframe2.textrange.text = "string" then
colShapes.add shp
end if
next shp
colShapes.fill.transparency = 0.8
Again, the purpose is to speed up the processing time so that VBA will apply the transparency modification in one sweep.
All suggestions/comments are welcome.
Thanks