J
JB2010
Hi there
I have a macro that makes a chart. I have included in it a userform to try
to control the size & layout of the chart's plot area & legend area. i cant
seem to find a way to make the numbers that come out of the userform
sucessfully change the chart layout, however.
in developing this macro,i have tried several different to set these
parameters. firstly, i tried it with simply the numbers & it works fine;
eg:
----------------------
ActiveChart.Legend.Select
Selection.Height = 34
Selection.Width = 40
Selection.Left = 684
Selection.Top = 196
ActiveChart.PlotArea.Select
Selection.Height = 416
Selection.Width = 673
Selection.Left = 1
Selection.Top = 25
---------------------
fair enough, but i want it to be more dynamic, so i tried this with a cell
ref where each cell equals the numbers above & i get nothing!
eg;
-----------------------------------
ActiveChart.Legend.Select
Selection.Height = Range("A1")
Selection.Width = Range("B1")
Selection.Left = Range("C1")
Selection.Top = Range("D1")
ActiveChart.PlotArea.Select
Selection.Height = Range("E1")
Selection.Width = Range("F1")
Selection.Left = Range("G1")
Selection.Top = Range("H1")
---------------
so then i tried something else, if i name a cell or the spinbutton value or
textbox value from the userform as a range & then quote that it still doesnt
work, though
eg;
--------------------
ActiveChart.Legend.Select
Selection.Height = LegH
Selection.Width = LegW
Selection.Left = LegL
Selection.Top = LegT
ActiveChart.PlotArea.Select
Selection.Height = PloH
Selection.Width = PloW
Selection.Left = PloL
Selection.Top = PloT
-----------------------
this is driving me up the wall!
i cant believe that it will only work if i enter a number rather than
anything else that draws it to the number.
any help gratefully recieved, let me know if you need more info
cheers
jb
I have a macro that makes a chart. I have included in it a userform to try
to control the size & layout of the chart's plot area & legend area. i cant
seem to find a way to make the numbers that come out of the userform
sucessfully change the chart layout, however.
in developing this macro,i have tried several different to set these
parameters. firstly, i tried it with simply the numbers & it works fine;
eg:
----------------------
ActiveChart.Legend.Select
Selection.Height = 34
Selection.Width = 40
Selection.Left = 684
Selection.Top = 196
ActiveChart.PlotArea.Select
Selection.Height = 416
Selection.Width = 673
Selection.Left = 1
Selection.Top = 25
---------------------
fair enough, but i want it to be more dynamic, so i tried this with a cell
ref where each cell equals the numbers above & i get nothing!
eg;
-----------------------------------
ActiveChart.Legend.Select
Selection.Height = Range("A1")
Selection.Width = Range("B1")
Selection.Left = Range("C1")
Selection.Top = Range("D1")
ActiveChart.PlotArea.Select
Selection.Height = Range("E1")
Selection.Width = Range("F1")
Selection.Left = Range("G1")
Selection.Top = Range("H1")
---------------
so then i tried something else, if i name a cell or the spinbutton value or
textbox value from the userform as a range & then quote that it still doesnt
work, though
eg;
--------------------
ActiveChart.Legend.Select
Selection.Height = LegH
Selection.Width = LegW
Selection.Left = LegL
Selection.Top = LegT
ActiveChart.PlotArea.Select
Selection.Height = PloH
Selection.Width = PloW
Selection.Left = PloL
Selection.Top = PloT
-----------------------
this is driving me up the wall!
i cant believe that it will only work if i enter a number rather than
anything else that draws it to the number.
any help gratefully recieved, let me know if you need more info
cheers
jb