PC Review


Reply
Thread Tools Rate Thread

Activechart.parent.left

 
 
David
Guest
Posts: n/a
 
      14th May 2009
Hi Group,

I am trying to place a chart in a specific location on the worksheet. This
code locates it to column N, but does not place it on Row 3, which I expected
to happen:

ActiveChart.Parent.Left = Range("N3").Left

I would also like to anchor it in the bottom right, basically locate and
size it. N3 to AB35.

Thanks for your help.

David
 
Reply With Quote
 
 
 
 
Tim Williams
Guest
Posts: n/a
 
      15th May 2009
David,

Left is just left, not top left.

Dim rng as range
Set rng = Sheet1.Range("N3:AB35")

with ActiveChart.Parent
.Top = rng.Cells(1).Top
.Left = rng.Cells(1).Left
.width= rng.Width
.Height=rng.Height
end with


Tim

"David" <(E-Mail Removed)> wrote in message
news:70B2F235-CD80-4BCD-A793-(E-Mail Removed)...
> Hi Group,
>
> I am trying to place a chart in a specific location on the worksheet. This
> code locates it to column N, but does not place it on Row 3, which I
> expected
> to happen:
>
> ActiveChart.Parent.Left = Range("N3").Left
>
> I would also like to anchor it in the bottom right, basically locate and
> size it. N3 to AB35.
>
> Thanks for your help.
>
> David



 
Reply With Quote
 
David
Guest
Posts: n/a
 
      15th May 2009
Hi Tim,

Thank you. I tried to look up help, since this is not quite doing what I
expected, but help was not very helpful. It is difficult to see what the
measures are, but I think it is in pixels? Some of the results:
?rng.Cells(1).Top = 25.5
?rng.Cells(1).Left = 202.5
?rng.Width = 780
?rng.Height = 420.75

The left-top ended up in E3, so I guess I need to figure out the pixels to
get it to N3. Again, thnk you for your help.

David




"Tim Williams" wrote:

> David,
>
> Left is just left, not top left.
>
> Dim rng as range
> Set rng = Sheet1.Range("N3:AB35")
>
> with ActiveChart.Parent
> .Top = rng.Cells(1).Top
> .Left = rng.Cells(1).Left
> .width= rng.Width
> .Height=rng.Height
> end with
>
>
> Tim
>
> "David" <(E-Mail Removed)> wrote in message
> news:70B2F235-CD80-4BCD-A793-(E-Mail Removed)...
> > Hi Group,
> >
> > I am trying to place a chart in a specific location on the worksheet. This
> > code locates it to column N, but does not place it on Row 3, which I
> > expected
> > to happen:
> >
> > ActiveChart.Parent.Left = Range("N3").Left
> >
> > I would also like to anchor it in the bottom right, basically locate and
> > size it. N3 to AB35.
> >
> > Thanks for your help.
> >
> > David

>
>
>

 
Reply With Quote
 
Tim Williams
Guest
Posts: n/a
 
      16th May 2009
David,

All I can say is it works for me. Is your chart located on Sheet1 ?
That was just an example, so you may need to modify to suit your situation

Here's a version which doesn't have a defined sheet reference - it just
looks at the sheet hosting the chart.

Sub Tester()
Dim rng As Range

With ActiveChart.Parent
Set rng = .Parent.Range("N3:AB35")
.Top = rng.Top
.Left = rng.Left
.Width = rng.Width
.Height = rng.Height
End With
End Sub

Tim


"David" <(E-Mail Removed)> wrote in message
news:29906EB6-6D35-4F5A-989F-(E-Mail Removed)...
> Hi Tim,
>
> Thank you. I tried to look up help, since this is not quite doing what I
> expected, but help was not very helpful. It is difficult to see what the
> measures are, but I think it is in pixels? Some of the results:
> ?rng.Cells(1).Top = 25.5
> ?rng.Cells(1).Left = 202.5
> ?rng.Width = 780
> ?rng.Height = 420.75
>
> The left-top ended up in E3, so I guess I need to figure out the pixels to
> get it to N3. Again, thnk you for your help.
>
> David
>
>
>
>
> "Tim Williams" wrote:
>
>> David,
>>
>> Left is just left, not top left.
>>
>> Dim rng as range
>> Set rng = Sheet1.Range("N3:AB35")
>>
>> with ActiveChart.Parent
>> .Top = rng.Cells(1).Top
>> .Left = rng.Cells(1).Left
>> .width= rng.Width
>> .Height=rng.Height
>> end with
>>
>>
>> Tim
>>
>> "David" <(E-Mail Removed)> wrote in message
>> news:70B2F235-CD80-4BCD-A793-(E-Mail Removed)...
>> > Hi Group,
>> >
>> > I am trying to place a chart in a specific location on the worksheet.
>> > This
>> > code locates it to column N, but does not place it on Row 3, which I
>> > expected
>> > to happen:
>> >
>> > ActiveChart.Parent.Left = Range("N3").Left
>> >
>> > I would also like to anchor it in the bottom right, basically locate
>> > and
>> > size it. N3 to AB35.
>> >
>> > Thanks for your help.
>> >
>> > David

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveChart location Danny Microsoft Excel Programming 1 23rd Oct 2009 09:35 PM
Return to parent page where I left it =?Utf-8?B?YmFrZXJfZWxpeg==?= Microsoft Frontpage 3 21st Jun 2007 11:01 PM
Catching left button down in the parent form =?Utf-8?B?S2VuRGV2?= Microsoft Dot NET Framework Forms 0 15th Feb 2006 08:09 PM
Activechart.SetSourceMethod grinning_crow Microsoft Excel Charting 2 1st Mar 2004 02:21 PM
Argument List Of ActiveChart.Location And ActiveChart.ChartType Mo Microsoft Excel Programming 2 1st Sep 2003 11:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:56 PM.