Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 590
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 590
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 590
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
moving charts - show data? tracktraining Excel Programming 0 June 5th 09 01:15 AM
moving charts tracktraining Excel Programming 0 February 28th 09 12:08 AM
OFFSET Charts - moving data length Paul Dennis Charts and Charting in Excel 0 December 19th 06 05:10 PM
Moving Average (Charts) Jamesy Charts and Charting in Excel 6 July 31st 06 09:59 AM
Moving Average (Charts) Jamesy Excel Discussion (Misc queries) 0 July 26th 06 10:11 AM


All times are GMT +1. The time now is 07:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"