Referencing an array within a For Next loop. Please help?
Hi Everyone,
This is the problem: I have a range which stores information about a structure. Adjacent to the range is an array which stores the co-ordinates (x, y) for the structure. Each cell in the range determines a condition at the co-ordinates provided in the same row in the array, and I want VBA then to draw a shape at those co-ordinates depending on what was specified in the array.
So essentially, I want to loop through the range, and depending on what is specified in the range, draw a shape at the co-ordinates provided in the array. Does this make sense?
If anyone can think of good way to achieve this I would be very grateful. I have also provided my code (which gets rejected) as a reference.
Thanks
Jinxtt
PHP Code:
Sub CreateSupports()
Dim DemoC As Worksheet Set DemoC = Worksheets(1) Dim SupportRange As Range Set SupportRange = Range("D6:D8") Dim SupportType As String Dim Pinned As Variant Dim Fixed As Variant Dim Cell As Variant For Each Cell In SupportRange Select Case SupportType Case Pinned DemoC.Shapes.AddShape msoShapeOval, SupportRange.Offset(-2, 0), SupportRange.Offset(-1, 0), 10, 10 Case Fixed DemoC.Shapes.AddShape msoShapeRectangle, 85, 200, 40, 15 End Select Next Cell End Sub
Bookmarks