Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Chart placement

Hi Group,

Thanks in advance. I have a chart created in VBA. Now I
want it to appear in a specific place on the worksheet. I
see code to move it around in pixels, I think that is
what it is anyway, but I don't see a way to place it on a
particular cell ie. upperleft corner of chart over "M2."
I see methods to find out what cell it is over, both
upper left corner and bottom right corner, but not ways
to "put" over certain cells. I was moving it in pixels,
but it is not consistantly placed in the same place on
the sheet to reliabily move it, to the same spot.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Chart placement

The following code postions the top left of the chart at the top left of
cell M2:

Sub PositionChart()
Dim ws As Worksheet
Dim chObj As ChartObject

Set ws = Sheets("Sheet1")
Set chObj = ws.ChartObjects(1)

With chObj
.Top = ws.Range("M2").Top
.Left = ws.Range("M2").Left
End With

End Sub


David wrote:
Hi Group,

Thanks in advance. I have a chart created in VBA. Now I
want it to appear in a specific place on the worksheet. I
see code to move it around in pixels, I think that is
what it is anyway, but I don't see a way to place it on a
particular cell ie. upperleft corner of chart over "M2."
I see methods to find out what cell it is over, both
upper left corner and bottom right corner, but not ways
to "put" over certain cells. I was moving it in pixels,
but it is not consistantly placed in the same place on
the sheet to reliabily move it, to the same spot.

Thanks



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Chart placement

Thank you Debra. In looking through all the help files, I
could not figure this out. Greatly appreciated.

-----Original Message-----
The following code postions the top left of the chart at

the top left of
cell M2:

Sub PositionChart()
Dim ws As Worksheet
Dim chObj As ChartObject

Set ws = Sheets("Sheet1")
Set chObj = ws.ChartObjects(1)

With chObj
.Top = ws.Range("M2").Top
.Left = ws.Range("M2").Left
End With

End Sub


David wrote:
Hi Group,

Thanks in advance. I have a chart created in VBA. Now

I
want it to appear in a specific place on the

worksheet. I
see code to move it around in pixels, I think that is
what it is anyway, but I don't see a way to place it

on a
particular cell ie. upperleft corner of chart

over "M2."
I see methods to find out what cell it is over, both
upper left corner and bottom right corner, but not

ways
to "put" over certain cells. I was moving it in

pixels,
but it is not consistantly placed in the same place on
the sheet to reliabily move it, to the same spot.

Thanks



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

.

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
Placement of a chart PCLIVE[_2_] Charts and Charting in Excel 1 January 25th 09 09:37 PM
decimal placement in an excel chart? Ron Charts and Charting in Excel 1 March 8th 08 02:12 AM
Name Placement lsmft Excel Discussion (Misc queries) 7 March 2nd 06 12:16 AM
Tab placement Spiff Excel Discussion (Misc queries) 1 September 15th 05 02:04 PM
Bar placement Beto[_3_] Excel Programming 2 January 15th 04 05:15 PM


All times are GMT +1. The time now is 11:57 PM.

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"