ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Legend moves across chart (https://www.excelbanter.com/excel-programming/366524-legend-moves-across-chart.html)

Sinus Log

Legend moves across chart
 
I have a line chart. When I change some specific values, a
macro is executed automatically. It changes the minimum and
maximum values on the horizontal axis, and also the number
format:
..MinimumScale=...
..MaximumScale=...
..TickLabels.NumberFormat=...

But then, the rectangle containing the legends moves. A few
pixels up, or to the left. Every time.

In the Format Legent screen, Placement tab, "Right" is
marked, and stays marked.

I suppose the macro is responsible, but I am not sure. How
do I fix that ?

Sinus Log

Legend moves across chart
 
Sinus Log wrote:
I have a line chart. When I change some specific values, a macro is
executed automatically. It changes the minimum and maximum values on the
horizontal axis, and also the number format:
.MinimumScale=...
.MaximumScale=...
.TickLabels.NumberFormat=...

But then, the rectangle containing the legends moves. A few pixels up,
or to the left. Every time.

In the Format Legent screen, Placement tab, "Right" is marked, and stays
marked.

I suppose the macro is responsible, but I am not sure. How do I fix that ?



Small error I made in my first post: it's an XY (Scatter) chart.

Andy Pope

Legend moves across chart
 
Hi,

I could not reproduce the problem from your description, although I have
seen it in the past.

Why not read the top and left properties of the legend at the beginning
of your macro and set them at the end if they have changed.

Cheers
Andy

Sinus Log wrote:
I have a line chart. When I change some specific values, a macro is
executed automatically. It changes the minimum and maximum values on the
horizontal axis, and also the number format:
.MinimumScale=...
.MaximumScale=...
.TickLabels.NumberFormat=...

But then, the rectangle containing the legends moves. A few pixels up,
or to the left. Every time.

In the Format Legent screen, Placement tab, "Right" is marked, and stays
marked.

I suppose the macro is responsible, but I am not sure. How do I fix that ?


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

Andy Pope

Legend moves across chart
 
Hi,

Can you email me the file, do not attached to this newsgroup.

I haven't seen this when the numbers in cells where modified and as I
said I can not get you code to re create the problem.

Cheers
Andy

Sinus Log wrote:
Andy Pope wrote:

Hi,

I could not reproduce the problem from your description, although I
have seen it in the past.

Why not read the top and left properties of the legend at the
beginning of your macro and set them at the end if they have changed.

Cheers
Andy


How do I do that ? It took me a couple of hours to figure out how to
program the number format. Could you tell me how to modify my code,
please ?
With graphique.Chart.Axes(xlCategory)
.MinimumScale = premPointComp
.MaximumScale = dernPointComp
.TickLabels.NumberFormat = formatNombres
End With

Thanks for your reply

PS: More on the symptoms
There's no problem until the macro is executed. The problem shows
afterwards when I modify a cell, even if that doesn't trigger the macro.


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

Sinus Log

Legend moves across chart
 
Andy Pope wrote:
Hi,

I could not reproduce the problem from your description, although I have
seen it in the past.

Why not read the top and left properties of the legend at the beginning
of your macro and set them at the end if they have changed.

Cheers
Andy


How do I do that ? It took me a couple of hours to figure
out how to program the number format. Could you tell me how
to modify my code, please ?
With graphique.Chart.Axes(xlCategory)
.MinimumScale = premPointComp
.MaximumScale = dernPointComp
.TickLabels.NumberFormat = formatNombres
End With

Thanks for your reply

PS: More on the symptoms
There's no problem until the macro is executed. The problem
shows afterwards when I modify a cell, even if that doesn't
trigger the macro.

Sinus Log

Legend moves across chart
 
Andy Pope wrote:
Hi,

Can you email me the file, do not attached to this newsgroup.

I haven't seen this when the numbers in cells where modified and as I
said I can not get you code to re create the problem.

Cheers
Andy

Sinus Log wrote:
Andy Pope wrote:

Hi,

I could not reproduce the problem from your description, although I
have seen it in the past.

Why not read the top and left properties of the legend at the
beginning of your macro and set them at the end if they have changed.

Cheers
Andy


How do I do that ? It took me a couple of hours to figure out how to
program the number format. Could you tell me how to modify my code,
please ?
With graphique.Chart.Axes(xlCategory)
.MinimumScale = premPointComp
.MaximumScale = dernPointComp
.TickLabels.NumberFormat = formatNombres
End With

Thanks for your reply

PS: More on the symptoms
There's no problem until the macro is executed. The problem shows
afterwards when I modify a cell, even if that doesn't trigger the macro.



Thanks, Andy


All times are GMT +1. The time now is 11:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com