Results 1 to 5 of 5

change position in VBA of chartobject doesn't work

Threaded View

  1. #1
    Forum Contributor
    Join Date
    09-21-2009
    Location
    Belgium - Mechelen
    MS-Off Ver
    Office 365 - version 2310
    Posts
    278

    change position in VBA of chartobject doesn't work

    Hi there ,

    I try to change the top position when adding a chartobject in a specific sheet.
    My purpose is to add several charts with their specific datarange , but each chart should be placed in a different region on the specific sheet.
    Therefor i put new values in the top , width , height and left position like :

    TPos = TPos + 250
    WPos = 385
    HPos = 255
    LPos = LPos + 390
    I use the following code to add the chart , but it stops at the Left:=LPos position in the code

            With Sheets(Charts).ChartObjects.Add _
                    (Left:=LPos, Width:=WPos, Top:=TPos, Height:=HPos)
                .Chart.ChartType = xlLine
                .Chart.SetSourceData Source:=Sheets("DataRange").Range(ChartDataRange)
                .Axes(xlValue).Select
                .Axes(xlValue).MinimumScale = 0
                .Axes(xlValue).MaximumScale = 40
                .Axes(xlValue).MaximumScale = 45
                .Axes(xlValue).MajorUnit = 5
                .Axes(xlValue).MinorUnit = 1
                .Legend.Select
                .Position = xlTop
        
            End With
    How can i use the variable TPos , Wpos , HPos and LPos in the code.
    Any help is welcome.

    Mario
    Last edited by MarMo; 08-22-2012 at 08:43 AM. Reason: problem solved

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1