How would I optimise the following code and use "with statements", rather than selecting the shape first in order to format it? I do understand that "with statements" in VBA work faster/more efficient than the "selection" method. Though I only know how to do it with "ranges" such as:
With Range("U64")
.Formula = "='Korea'!DW401"
End With
But how would I apply that to a certain shape without selecting it first as in the example below?
ActiveSheet.Shapes.Range(Array("Rounded Rectangle 3")).Select
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(229, 229, 229)
.Transparency = 0
.Solid
End With
I renamed the shape to "Japan" and tried to change it's colour with a "with statement" (see below), but it doesn't seem to work!
Sub FormatShape()
With Shape.("Japan")
.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(229, 229, 229)
.Transparency = 0
.Solid
End With
Does anyone know what I'm doing wrong?
Bookmarks