Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moving Charts
I have a set of macros that loop through all my worksheets and move my charts.
I have found that the charts do not always move. Do I need to place some type refresh after each move? Thank you. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moving Charts
Moving charts should be pretty straightforward with no need to 'Refresh'.
More likely your code is not doing what you think it is. Regards, Peter T "Ken" wrote in message ... I have a set of macros that loop through all my worksheets and move my charts. I have found that the charts do not always move. Do I need to place some type refresh after each move? Thank you. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moving Charts
Hi Peter,
Here is the code I am using: Set objChart = oSheet.ChartObjects(PlotName) objChart.Activate With objChart .Top = PlotTop .Left = PlotLeft .Width = PlotWidth .Height = PlotHeight End With I calculate PlotTop using: PlotTop = oSheet.Rows(ChartTopRow).Top oSheet is set to the current worksheet (worksheet object) and ChartTopRow is set to 44. The plot is moving to the top of row 57. Ken "Peter T" wrote: Moving charts should be pretty straightforward with no need to 'Refresh'. More likely your code is not doing what you think it is. Regards, Peter T "Ken" wrote in message ... I have a set of macros that loop through all my worksheets and move my charts. I have found that the charts do not always move. Do I need to place some type refresh after each move? Thank you. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moving Charts
From what you've described your code looks OK but we can't see your actual
variables, so must be something else only you can see. Eg, what's ChartTopRow Sub test() Dim lt As Double Dim tp As Double Dim chtObj As ChartObject lt = ActiveSheet.Columns(2).Left tp = ActiveSheet.Rows(44).Top Set chtObj = ActiveSheet.ChartObjects.Add(0, 0, 200, 100) With chtObj .Left = lt .Top = tp End With Application.Goto Range("a40"), True End Sub In passing, no need to Activate your chart Regards, Peter T "Ken" wrote in message ... Hi Peter, Here is the code I am using: Set objChart = oSheet.ChartObjects(PlotName) objChart.Activate With objChart .Top = PlotTop .Left = PlotLeft .Width = PlotWidth .Height = PlotHeight End With I calculate PlotTop using: PlotTop = oSheet.Rows(ChartTopRow).Top oSheet is set to the current worksheet (worksheet object) and ChartTopRow is set to 44. The plot is moving to the top of row 57. Ken "Peter T" wrote: Moving charts should be pretty straightforward with no need to 'Refresh'. More likely your code is not doing what you think it is. Regards, Peter T "Ken" wrote in message ... I have a set of macros that loop through all my worksheets and move my charts. I have found that the charts do not always move. Do I need to place some type refresh after each move? Thank you. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moving Charts
Peter,
ChartTopRow was a variable I passed into a move and position funciton. I found the problem in that I was passing in the ChartTopRow byref and it should have been byval as I was modifying it in the code. Thanks for the help. "Peter T" wrote: From what you've described your code looks OK but we can't see your actual variables, so must be something else only you can see. Eg, what's ChartTopRow Sub test() Dim lt As Double Dim tp As Double Dim chtObj As ChartObject lt = ActiveSheet.Columns(2).Left tp = ActiveSheet.Rows(44).Top Set chtObj = ActiveSheet.ChartObjects.Add(0, 0, 200, 100) With chtObj .Left = lt .Top = tp End With Application.Goto Range("a40"), True End Sub In passing, no need to Activate your chart Regards, Peter T "Ken" wrote in message ... Hi Peter, Here is the code I am using: Set objChart = oSheet.ChartObjects(PlotName) objChart.Activate With objChart .Top = PlotTop .Left = PlotLeft .Width = PlotWidth .Height = PlotHeight End With I calculate PlotTop using: PlotTop = oSheet.Rows(ChartTopRow).Top oSheet is set to the current worksheet (worksheet object) and ChartTopRow is set to 44. The plot is moving to the top of row 57. Ken "Peter T" wrote: Moving charts should be pretty straightforward with no need to 'Refresh'. More likely your code is not doing what you think it is. Regards, Peter T "Ken" wrote in message ... I have a set of macros that loop through all my worksheets and move my charts. I have found that the charts do not always move. Do I need to place some type refresh after each move? Thank you. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
moving charts - show data? | Excel Programming | |||
moving charts | Excel Programming | |||
OFFSET Charts - moving data length | Charts and Charting in Excel | |||
Moving Average (Charts) | Charts and Charting in Excel | |||
Moving Average (Charts) | Excel Discussion (Misc queries) |