+ Reply to Thread
Results 1 to 4 of 4

HOW to Place chart at specific cell location with MACRO VBA

  1. #1
    Registered User
    Join Date
    06-10-2015
    Location
    Jordan
    MS-Off Ver
    2010
    Posts
    2

    Exclamation HOW to Place chart at specific cell location with MACRO VBA

    How to place a chart at a specific cell location within a worksheet. I am adding a chart using pivot table within the same sheet
    and need to place the chart under the data.

    The code I am using to add the chart is as follows, and it's working fine but I need to know if there is away to set the location by column# and row# eg. position (r1,c2) to set the chart under my pivot table in dynamic way



    Sub sbPivotChart_SameSheet()
    Dim pt As PivotTable, ptr As Range, Cht As Chart
    If ActiveSheet.PivotTables.Count = 0 Then Exit Sub
    Set pt = ActiveSheet.PivotTables(2)
    Set ptr = pt.TableRange1
    Set Cht = ActiveSheet.Shapes.AddChart.Chart

    With cht.ChartArea
    'adjust position and size (both in points) of the Chart Area:
    .Width = 440
    .Height = 300
    .Left = 100
    .Top = 100
    End With
    With Cht
    .SetSourceData ptr
    .ChartType = xlLine
    End With
    End Sub
    Last edited by asmaasab; 06-10-2015 at 10:02 AM.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: HOW to Place chart at specific cell location with MACRO VBA

    This is an old post, but it might be helpful
    http://www.excelforum.com/excel-prog...-location.html
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    06-10-2015
    Location
    Jordan
    MS-Off Ver
    2010
    Posts
    2

    Re: HOW to Place chart at specific cell location with MACRO VBA

    Thank you, very helpful link (y)

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: HOW to Place chart at specific cell location with MACRO VBA

    You're welcome, glad it helped you out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 07-11-2013, 02:08 AM
  2. Replies: 1
    Last Post: 06-30-2013, 05:58 PM
  3. insert a photo (any file type), resize it, and place it in a specific location.
    By jaganath in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-19-2010, 08:44 AM
  4. Macro for PDF to specific location and file name from Cell
    By NokiaFanatic in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-13-2010, 12:00 AM
  5. [SOLVED] Place chart at specific cell location
    By Landmine in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2006, 12:40 AM

Tags for this Thread

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