I recorded a macro to align label positions in a graph.
Here is an example for the label position of one data point:
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.FullSeriesCollection(11).Points(10).DataLabel.Select
Selection.Left = 200.302
It works fine, but what could be the reason, that if a colleague runs the macro on a different computer the position of the labels is different? The macro still works fine, just the position is not where it should be, but more to the right.
Hi Matthias,
Does that other computer have a different display resolution?
Try recording the same macro on his computer, you will see the differences. You can run a different code if the code detects another user name.
Hi Catalin,
so we have 4 possible resolutions to consider: 2(him and me) 2(primary and secondary screen).
Now add different colleagues and a 3rd screen for everyone ... 🙂
A solution could be to adapt the resolution before running the macro. Could that be dealt also by VBA?
Thanks,
Matthias
Hi Matthias,
You can try this code: http://www.vbaexpress.com/kb/getarticle.php?kb_id=32
Note that the icons on the desktop of that user may be messed up when you change the resolution.
Thanks a lot, Catalin. That's a good proposal!