Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Placement of a chart | Charts and Charting in Excel | |||
decimal placement in an excel chart? | Charts and Charting in Excel | |||
Name Placement | Excel Discussion (Misc queries) | |||
Tab placement | Excel Discussion (Misc queries) | |||
Bar placement | Excel Programming |