Using Excel 2007 VBA. I have a single Chart on a sheet that overlaps its source data. When cleaning up I hide the data rows, but the Chart is shrinking in height.
I know I can set the “Don’t move or size with cells” to True, but I don’t know how to do this programmatically from VBA. I tried just recording a macro, but it didn’t show up.
I could have been a little more specific in my question by indicating that I had access to a
ChartObject object in VBA. Therefore, when I came across various examples on the internet using
Shape.Placement = vbFreeFloating, I wasn’t sure how to use it on a
ChartObject. As I mentioned in a comment above, this page mentions that you can access the
Shape associated with a
ChartObject by the using
ChartObject.Parent property. Then it’s simply a matter of doing
ChartObject.Parent.Placement = vbFreeFloating. This appears to have solved my problem. Hope it helps someone else.