I only dabble in VBA and am not experienced. So thank you to whoever reads this and tries to help.
I have a circle shape that I'm trying to duplicate. The number of duplicates required and their spacing are variable cell inputs in the worksheet.
When I run my macro by pressing F8, I have isolated which line of code is malfunctioning. For a little context, I have added the line before and after:
For i8 = 1 To (Range("I13") - 1)
Sheets("4. Column").Shapes.Range(Array("Reo bar layer 8")).Duplicate.IncrementLeft (i8 * Range("I26") / 3.55)
Next i8
What I expect from these 3 lines of VBA code:
When cell I26 is say 120 then the spacing of the duplicates should be 120/3.55 points apart (horizontally)
When cell I13 is say 4, then the duplicate shapes should be 3 in addition to the original shape.
The problem:
The first duplicate shape appears to be offset vertically (by what appears to me by some random amount) when there shouldnt be a vertical component. The following iterative duplicates appear to be functioning well (no vertical offset). Furthermore, the first duplicate is also offset horizontally for amount in addition to the specified amount. I cannot work out why this is happening as the duplicate.IncrementLeft is meant to only be a horizontal duplicate. And to make it more confusing, there was a time when this line of code worked perfectly.
The attached shows what I mean. where the blue filled circle shapes should be bound and equally spaced within the round cornered rectangle. I cant work out why this is happening.
I appreciate the efforts of anyone who can help me!
I have a circle shape that I'm trying to duplicate. The number of duplicates required and their spacing are variable cell inputs in the worksheet.
When I run my macro by pressing F8, I have isolated which line of code is malfunctioning. For a little context, I have added the line before and after:
For i8 = 1 To (Range("I13") - 1)
Sheets("4. Column").Shapes.Range(Array("Reo bar layer 8")).Duplicate.IncrementLeft (i8 * Range("I26") / 3.55)
Next i8
What I expect from these 3 lines of VBA code:
When cell I26 is say 120 then the spacing of the duplicates should be 120/3.55 points apart (horizontally)
When cell I13 is say 4, then the duplicate shapes should be 3 in addition to the original shape.
The problem:
The first duplicate shape appears to be offset vertically (by what appears to me by some random amount) when there shouldnt be a vertical component. The following iterative duplicates appear to be functioning well (no vertical offset). Furthermore, the first duplicate is also offset horizontally for amount in addition to the specified amount. I cannot work out why this is happening as the duplicate.IncrementLeft is meant to only be a horizontal duplicate. And to make it more confusing, there was a time when this line of code worked perfectly.
The attached shows what I mean. where the blue filled circle shapes should be bound and equally spaced within the round cornered rectangle. I cant work out why this is happening.
I appreciate the efforts of anyone who can help me!